美文网首页
redis主从+哨兵搭建

redis主从+哨兵搭建

作者: 雪_豹 | 来源:发表于2020-08-22 17:01 被阅读0次

在redis主从搭建基础上代码搭建哨兵
1、程序目录下创建sentinel目录
2、创建3配置文件

image.png
端口分别是26381、26382、26383,别名mymaster三个必须一致
sentinel-26381.conf
daemonize yes
port 26381
logfile "sentinel-26381.log"
sentinel monitor mymaster 127.0.0.1 6381 2
sentinel auth-pass mymaster 123456

sentinel-26382.conf

daemonize yes
port 26382
logfile "sentinel-26382.log"
sentinel monitor mymaster 127.0.0.1 6382 2
sentinel auth-pass mymaster 123456

sentinel-26383.conf

daemonize yes
port 26383
logfile "sentinel-26383.log"
sentinel monitor mymaster 127.0.0.1 6383 2
sentinel auth-pass mymaster 123456

3、启动顺序,主节点->从节点->哨兵节点
./redis-sentinel sentinel/sentinel-26381.conf
./redis-sentinel sentinel/sentinel-26382.conf
./redis-sentinel sentinel/sentinel-26383.conf
4、验证,进入redis命令行
随便进一个redis节点:./redis-cli -p 6383
用命令查看节点详情:info replication
杀死主节点前后查看节点详情做对比

image.png

相关文章

网友评论

      本文标题:redis主从+哨兵搭建

      本文链接:https://www.haomeiwen.com/subject/tgbvjktx.html