redis哨兵模式配置

2021-04-01 16:00:00
admin
原创
2320
摘要:redis哨兵模式配置

redis哨兵模式配置

1、redis的主服务器的redis.conf配置

daemonize yes 
protected-mode no
requirepass 123456
masterauth 123456
2、redis的从服务器的redis.conf的配置
daemonize yes 
protected-mode no
requirepass 123456
masterauth 123456
slaveof 192.168.56.100 6379

3、redis的从服务器的sentinel.conf配置


protected-mode no
# sentinel monitor代表监控
# mymaster代表服务器的名称,可以自定义,
# 192.168.72.129代表监控的主服务器,6379代表端口,
# 2 标识 >=2 哨兵认为主服务器不可用,执行failover操作。
sentinel monitor mymaster 192.168.56.100 6379 2
sentinel auth-pass mymaster 123456
daemonize yes 
4、先启动主从的redis



cd src
./redis-server ../redis.conf
5、启从服务器的sentinel


./redis-sentinel ../sentinel.conf

6、redis的哨兵模式的测试


redis-cli -h 192.168.56.100 -p 6379 -a "123456"
然后执行 info replication

主服务器配置截图

从服务器配置截图

    发表评论
    评论通过审核之后才会显示。
    文章分类
    联系方式
    联系人: 郑州-小万
    电话: 13803993919
    Email: 1027060531@qq.com
    QQ: 1027060531
    网址: www.wanhejia.com