redis-哨兵模式

本文详细指导了如何在Redis中配置三个哨兵实例,实现主从复制,并分别编辑sentinel配置文件,以监控不同主库实例。涉及操作包括启动哨兵、复制配置文件和调整sentinel参数以适应不同的主从组合。

哨兵模式配置

##⾸先实现三个redis实例之间的主从配置(如上)
## 创建并启动三个哨兵
## 拷⻉sentinel.conf⽂件三份:sentinel-26380.conf sentinel-26382.conf
sentinel-26382.conf
## 创建sentinelconf⽬录
[root@theo redis-5.0.5]# mkdir sentinelconf
## 拷⻉sentinel.conf⽂件到 sentinelconf⽬录:sentinel-26380.conf
[root@theo redis-5.0.5]# cat sentinel.conf | grep -v "#" | grep -v "^$" > sentinelconf/sentinel-26380.conf
[root@theo redis-5.0.5]# cd sentinelconf/
[root@theo sentinelconf]# ll
total 4
-rw-r--r-- 1 root root 326 May 19 17:09 sentinel-26380.conf
## 编辑 sentinelconf/sentinel-26380.conf⽂件
[root@theo sentinelconf]# vim sentinel-26380.conf
port 26380
daemonize no
pidfile "/var/run/redis-sentinel-26380.pid"
logfile ""
dir "/tmp"
sentinel deny-scripts-reconfig yes
# 此处配置默认的主库的ip 和端⼝ 最后的数字是哨兵数量的⼀半多⼀个
sentinel monitor mymaster 127.0.0.1 6380 2
sentinel config-epoch mymaster 1
sentinel leader-epoch mymaster 1
protected-mode no
[root@theo sentinelconf]# sed 's/26380/26381/g' sentinel-26380.conf > sentinel-26381.conf
[root@theo sentinelconf]# sed 's/26380/26382/g' sentinel-26380.conf > sentinel-26382.conf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值