查看进程 ps -ef|grep redis
info replication :查看当前库信息
复制3个配置文件redis.conf
改成6380.conf、6381.conf、6382.conf
修改三个文件中的内容:
92行 port 6380(端口号)
136 行 daemonize yes (开启后台运行)
158行 pidfile “/var/run/redis_6380.pid”(pid名字)
171行 logfile “6380.log”(log文件名字)
253行 dbfilename “dump6380.rdb”(dump.rdb文件)
启动 redis-server redis.conf
连接 redis-cli -p 6380
slaveof 127.0.0.1 6380 认主机 (在6379 6381 中输入)
vim sentinel.conf(创建哨兵文件)
把这句sentinel monitor myredis 127.0.0.1 6380 1 加到 sentinel.conf中
redis-sentinel sentinel.conf 启动哨兵