Redis集群 (二)------ 集群搭建之Sentinel模式

1、环境及IP、端口分配

环境:centos7.0 redis6.0.8
 
三台虚拟机搭建一主两从三哨兵

master 192.168.239.136 7001 sentinel端口:8001

slave 192.168.239.134 7002 sentinel端口:8002

slave 192.168.239.135 7003 sentinel端口:8003

 

2、master-sentinel配置

.136添加master-server配置文件

vi /usr/local/redis/sen.conf

port 8001
daemonize yes
logfile "./8001.log"
dir ./
sentinel monitor MyMaster 192.168.239.136 7001 2
sentinel down-after-milliseconds MyMaster 1500
sentinel failover-timeout MyMaster 10000
sentinel auth-pass MyMaster r123
sentinel config-epoch MyMaster 15

MyMaster:监控主数据的名称,自定义即可,

192.168.239.136:监控的主数据库的IP

7001:监控的主数据库的端口

2:最低通过票数

 

3、slave-sentinel配置

.134添加master-server配置文件

vi /usr/local/redis/sen.conf

port 8002
daemonize yes
logfile "./8002.log"
dir ./
sentinel monitor MyMaster 192.168.239.136 7001 2
sentinel down-after-milliseconds MyMaster 1500
sentinel failover-timeout MyMaster 10000
sentinel auth-pass MyMaster 123
sentinel config-epoch MyMaster 15

.135添加master-server配置文件

vi /usr/local/redis/sen.conf

port 8003
daemonize yes
logfile "./8003.log"
dir ./
sentinel monitor MyMaster 192.168.239.136 7001 2
sentinel down-after-milliseconds MyMaster 1500
sentinel failover-timeout MyMaster 10000
sentinel auth-pass MyMaster 123
sentinel config-epoch MyMaster 15

 

4、启动哨兵

三台机子均启动

# redis-sentinel  /usr/local/redis/sen.conf

相关日志可在conf文件中指定的文件内查看

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值