Linux上安装Redis5.0.9
都这个时候了为什么不按照6.0.8
你好!6.0.8版本安装需要使用很高版本的gcc,即使升级了,编译还是出错。
下载5.0.9
下载地址:https://download.redis.io/releases/redis-5.0.9.tar.gz
把文件移动到/usr/local/
解压redis-5.0.9.tar.gz
tar -zxvf redis-5.0.9.tar.gz
编译
cd redis-5.0.9
make
修改配置文件redis.conf
文件在/user/local/redis-5.0.9路径下
bind 0.0.0.0
protected-mode yes
port 6379 #端口
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes # 后台模式启动
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
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.rdb
dir ./
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
requirepass ABC888*** #此处是密码
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
将启动命令、客户端命令加入到全局命令中
第三个参数是redis-server、redis-cli所在路径
ln -s /usr/local/redis-5.0.9/src/redis-server /usr/bin/redis-server
ln -s /usr/local/redis-5.0.9/src/redis-cli /usr/bin/redis-cli
启动Redis
第二个参数是conf配置路径
redis-server /usr/local/redis-5.0.9/redis.conf
登录Redis
-h后面是host参数 -p后面是端口号
auth 后面是密码,看到OK即登录成功,
输入ping命令,看到PONG就可以使用了。
redis-cli -h 127.0.0.1 -p 6888
127.0.0.1:6888> auth ABC888***
OK
127.0.0.1:6888> ping
PONG
开机自启动
vi /etc/rc.local
在最后一行加入
redis-server /usr/local/redis-5.0.9/redis-conf
从其他地方访问,还需要关闭linux防火墙
systemctl disable firewalld