栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Docker安装Redis哨兵架构

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Docker安装Redis哨兵架构

哨兵架构是在主从的基础上安装的,关于主从架构搭建请参考Redis主从搭建,本文搭建基于云服务器

硬件配置如下

IP描述
121.36.172.25主节点、哨兵1
122.112.237.126从节点、哨兵2
119.3.91.242从节点、哨兵3

在每台机器的conf目录下创建sentinel.conf文件,内容如下

# bind 127.0.0.1 192.168.1.1
# protected-mode no
port 26379
#daemonize yes
#pidfile /var/run/redis-sentinel.pid
logfile "sentinel.log"
sentinel monitor master001 121.36.172.25 6379 2
sentinel auth-pass master001 qwer123456
sentinel down-after-milliseconds master001 10000
sentinel parallel-syncs master001 1
sentinel failover-timeout master001 180000

sentinel announce-ip 121.36.172.25
sentinel announce-port 26379

sentinel deny-scripts-reconfig yes

需要注意的是:

1、三台机器的mastername(master001 )需要一致

2、由于在docker环境下安装,需要暴露当前节点通信ip+port

sentinel announce-ip 当前机器IP

sentinel announce-port 当前sentinel端口

3、由于哨兵模式下主从会进行故障切换,所以主从密码需要设置一样,并且在主节点redis.conf 也要配置主节点密码 masterauth qwer123456

在每台机器上启动容器,我使用的是podman,

podman run -d -p 26379:26379 --name sentinel-local --privileged=true -v /data/redis/conf/sentinel.conf:/etc/redis/sentinel.conf -v /data/redis/data:/data f1b6973564e9 redis-sentinel /etc/redis/sentinel.conf

启动成功后每台机器的sentinel.log下

哨兵全部启动后如下

 

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/747702.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号