原文

https://developer.aliyun.com/article/316179

环境

Master/Slave 系统 IP Redis 版本
Master CentOS6.7 10.10.3.211 redis-3.2.6
Slave CentOS6.7 10.10.3.212 redis-3.2.6

Master 配置

Master 都是基本的配置,但要将 bind 127.0.0.1 改为 bind 0.0.0.0 ,要不然 Slave 会连不上,日志提示 “Error condition on socket for SYNC: Connection refused”

Slave 配置

Slave 除基本的配置外,需要增加 slaveof 10.10.3.211 6379 如果Master 有密码就配置 masterauth

重启主从 redis 的服务

查看主从 redis 信息 redis-cli info

image-20200804144202658

测试

image-20200804144217229