(1)三个sentinel服务
(2)一主三从,即四个Redis服务
建议先查看《Redis集群搭建-主从模式》
一、哨兵模式搭建步骤
(1)拷贝三个redis服务作为sentinel服务
(2)分别修改sentinel01、sentinel02、sentinel03中的sentinel.conf配置
①修改sentinel.conf
不同于普通的redis服务使用的redis.conf配置,sentinel服务使用的是sentinel.conf配置。
②修改端口号配置
因为同样将sentinel的三个服务放在了同一个服务器上,所以服务的端口号不能相同。(sentinel01的端口号:26371;sentinel02的端口号:26372;sentinel03的端口号:26373)
③配置redis服务的主服务地址与端口号
sentinel01、sentinel02、sentinel03此项配置相同。
格式:sentinel monitor 主服务名称 主服务IP地址 主服务端口号 投票数
mater:6371 主服务名称,自定义。不能使用特殊字符或空格
127.