码迷,mamicode.com
首页 > 其他好文 > 详细

redis单机安装

时间:2020-07-06 12:57:49      阅读:49      评论:0      收藏:0      [点我收藏+]

标签:prefix   logo   装包   命令   -o   incr   red   Fix   load   

一、安装依赖,redis是C语言写的

[root@t2 ~]# yum install -y gcc

二、下载redis

mkdir /app && cd app
[root@t2 app]# wget http://download.redis.io/releases/redis-5.0.8.tar.gz

三、解压安装包

tar -zxvf redis-5.0.8.tar.gz 

四、编译安装redis

#进入解压目录
[root@t2 app]# cd redis-5.0.8
#编译
[root@t2 redis-5.0.8]# make
#出现这个说明成功编译
Hint: It‘s a good idea to run ‘make test‘ ;)
make[1]: Leaving directory `/app/redis-5.0.8/src‘
?
#make test 运行测试,确认redis的功能是否正常
#我centos7缺tcl包、执行以下命令安装、安装完重新编译
[root@t2 ~]# yum install tcl -y
[root@t2 ~]# make distclean
[root@t2 ~]# make
#出现下面的提示说明测试成功
\o/ All tests passed without errors!
Cleanup: may take some time... OK
make[1]: Leaving directory `/app/redis-5.0.8/src
?
#指定目录安装
[root@t2 src]# make install PREFIX=/app/redis/
#出现以下提示就成功了
Hint: It‘s a good idea to run ‘make test‘ ;)
?
  INSTALL install
  INSTALL install
  INSTALL install
  INSTALL install
  INSTALL install

五、启动redis

#复制配置文件到刚刚的安装目录/app/redis
cd /app/redis && mkdir conf && cd conf
cp /app/redis-5.0.8/redis.conf ./
#创建pid文件
[root@t2 redis]# pwd
/app/redis
#创建以下目录存数据,pid,日志
[root@t2 redis]# mkdir {pid,logs,data}
[root@t2 pid]# cd pid/  
[root@t2 pid]# touch redis_6379.pid
#更改配置文件(配置文件在搭建集群再给大家介绍,我把全部配置文件贴出来,避免你们出错误)
[root@t2 conf]# cat redis.conf |grep -v ^"#" | grep -v ^$
bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /app/redis/pid/redis_6379.pid
loglevel notice
logfile "/app/redis/logs/redis-6379.log"
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump-6379.rdb
dir /app/redis/data
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
[root@t2 conf]# cat redis.conf |grep -v ^"#" | grep -v ^$
bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /app/redis/pid/redis_6379.pid
loglevel notice
logfile "/app/redis/logs/redis-6379.log"
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump-6379.rdb
dir /app/redis/data
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
###启动
[root@t2 bin]# pwd
/app/redis/bin
[root@t2 bin]# ./redis-server ../conf/redis.conf

六、测试

#连接测试、成功安装了redis     
[root@t2 bin]# ./redis-cli
127.0.0.1:6379> set tzh 11
OK
127.0.0.1:6379> get tzh
"11"
127.0.0.1:6379> exit

 

redis单机安装

标签:prefix   logo   装包   命令   -o   incr   red   Fix   load   

原文地址:https://www.cnblogs.com/hsyw/p/13254117.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!