设置三个redis配置文件
- redis.conf
- redis6380.conf (主机器)
- redis6381.conf (从)
- redis6381.conf (从)
配置redis6380.conf
include redis.conf
pidfile /var/run/redis_6380.pid
port 6380
dbfilename "appendonly6380.aof"
cluster-enabled yes 打开集群模式
// 设置优先级 越小优先成为master
replica-priority 100
运行
// 进入6381机器
redis-server redis6381.conf
// 选定机器作为master
slaveof 127.0.0.1 6380
// 查看6380机器的信息
info replication