Redis主从配置
主配置
-
修改
/etc/redis/redis.conf
sudo vi redis.conf bind your <ip>
-
重启Redis服务
ps aux | grep redis # kill process sudo kill -9 <process pid> # start sudo redis-server /etc/redis/redis.conf
从配置
-
复制
/etc/redis/redis.conf
sudp cp redis.conf ./slave.conf
-
修改
redis/slave.conf
sudo vi slave.conf # 编辑内容 bind <your ip> slaveof <your ip> <your port> port <slave new port>
-
开启
redis
服务sudo redis-server slave.conf
-
查看主从关系
redis-cli -h <your ip> info Replication