下载redis

wget http://download.redis.io/releases/redis-5.0.9.tar.gz

安装依赖包

yum install -y epel-release
yum install -y gcc

解压及编译

cd /soft
tar -zxvf redis-5.0.9.tar.gz
cd redis-5.0.9.tar.gz
make PREFIX=/usr/local/redis

配置

https://redis.io/topics/config 页面下载对应版本的配置文件

cd /usr/local/redis/bin

wget https://raw.githubusercontent.com/redis/redis/5.0/redis.conf

vi redis.conf

#编辑

bind 127.0.0.1

#改成

bind 0.0.0.0

#以允许远程访问

后台运行我这里以supervisor代替,常规的可以修改配置文件里

daemonize no
#改成
daemonize yes

supervisor配置文件

[program:redis5.0.9]
command = /usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
directory = /usr/local/redis/bin
process_name = %(program_name)s_%(process_num)s
numprocs = 1 ;注意这里只能为1
autostart = true     ; 在 supervisord 启动的时候也自动启动
startsecs = 5        ; 启动 5 秒后没有异常退出,就当作已经正常启动了
autorestart = true   ; 程序异常退出后自动重启
startretries = 3     ; 启动失败自动重试次数,默认是 3
user = root          ; 用哪个用户启动
stdout_logfile=/tools/supervisor/logs/redis/redis.out.log
stdout_logfile_maxbytes = 10MB
stderr_logfile=/tools/supervisor/logs/redis/redis.err.log
stderr_logfile_maxbytes = 10MB

supervisor

Last modification:September 1st, 2020 at 05:48 pm
坚持技术分享,您的支持将鼓励我继续创作!