Centos7.x安装 Redis 5.0.9
# 解压redis-5.0.9
tar -zxvf redis-5.0.9.tar.gz
# 编译redis
make
# 安装到指定目录
make PREFIX=/usr/local/resources/redis-5.0.9 install
# 修改配置文件redis.conf
bind 0.0.0.0 -- 绑定访问IP地址
daemonize yes -- 设置后台启动
dir /usr/local/resources/redis-5.0.9/data -- 设置默认工作空间(数据存储位置)
requirepass yuluomoshang -- 设置redis登录密码
pidfile /usr/local/resources/redis-5.0.9/run/redis_6379.pid
# 修改启动脚本redis_init_script
EXEC=/usr/local/resources/redis-5.0.9/bin/redis-server
CLIEXEC=/usr/local/resources/redis-5.0.9/bin/redis-cli
PIDFILE=/usr/local/resources/redis-5.0.9/run/redis_6379.pid
CONF="/usr/local/resources/redis-5.0.9/conf/redis.conf"
# 修改stop指令中对应参数
$CLIEXEC -a "yuluomoshang" -p $REDISPORT shutdown