绑定IP只需在redis.conf中添加bind 内网IP
以服务方式运行可以借助supervisor:
[program:redis]
directory=/data/redis/redis-3.2.2
command=/data/redis/redis-3.2.2/src/redis-server redis.conf
autostart=true
autorestart=true
stderr_logfile=/var/log/redis.err.log
stdout_logfile=/var/log/redis.out.log
user=root
stopsignal=INT
注:不要在redis.conf中将daemonize no
改为daemonize yes
,不然supervisor无法运行redis,会报错:
redis FATAL Exited too quickly (process log may have details)