下载安装包:wget http://download.redis.io/releases/redis-4.0.10.tar.gz
解压:tar xzvf redis-4.0.10.tar.gz
安装:
cd redis-4.0.10
make
make install
修改配置文件:vi conf/redis.conf
daemonize yes
bind 0.0.0.0
requirepass 1234
pidfile /home/soft/redis-4.0.10/run/redis_6379.pid
logfile "/home/soft/redis-4.0.10/log/redis.log"
备机配置主从,修改配置文件:
slaveof 主IP 端口
masterauth 主密码,无密码可忽略
daemonize yes
bind 0.0.0.0
requirepass 1234
pidfile /home/soft/redis-4.0.10/run/redis_6379.pid
logfile "/home/soft/redis-4.0.10/log/redis.log"
启动:redis-server /路径xxx/redis.conf
主从同步测试:
./redis-cli
auth 1234
set test1 1234
主机存储后从机获取:
get test1