1、redis sentinel
![img_75145b09f536362a6f7b734a7d3c6def.png](https://yqfile.alicdn.com/img_75145b09f536362a6f7b734a7d3c6def.png?x-oss-process=image/resize,w_1400/format,webp)
2、
![img_951e760c9a18aa8fd6c57d5f2ca18e22.png](https://yqfile.alicdn.com/img_951e760c9a18aa8fd6c57d5f2ca18e22.png?x-oss-process=image/resize,w_1400/format,webp)
![img_4a71f613282469f7ded4dd0a7a4ca86c.png](https://yqfile.alicdn.com/img_4a71f613282469f7ded4dd0a7a4ca86c.png?x-oss-process=image/resize,w_1400/format,webp)
3、一主二从:
主:
redis-6379.conf
port 6379
daemonize yes
logfile "6379.log"
dbfilename "dump-6379.rdb"
dir "/opt/"
启动: redis-server redis-6379.conf
从:
redis-6380.conf
port 6380
daemonize yes
logfile "6380.log"
dbfilename "dump-6380.rdb"
dir "/opt/"
slaveof 127.0.0.1 6379
info replication
部署3个sentinel:
redis- sentinel- 26379. conf
port 26379
daemonize yes
logfile "26379. log"
dir /opt/ soft/ redis/ data
sentinel monitor mymaster 127. 0. 0. 1 6379 2 #2,一般设置为从节点的一半加1
sentinel down- after- milliseconds mymaster 30000
sentinel parallel- syncs mymaster 1 #parallel- syncs 就是 用来 限制 在 一次 故障 转移 之后, 每次 向 新的 主 节点 发起 复制 操作 的 从 节点 个数。
sentinel failover- timeout mymaster 180000
启动:redis-server redis-sentinel-26379.conf --sentinel
![img_20125fd1da3134f1fd23743f24a1d719.png](https://yqfile.alicdn.com/img_20125fd1da3134f1fd23743f24a1d719.png?x-oss-process=image/resize,w_1400/format,webp)
info sentinel
![img_2a4871b555f1ab6afffc37977af057cb.png](https://yqfile.alicdn.com/img_2a4871b555f1ab6afffc37977af057cb.png?x-oss-process=image/resize,w_1400/format,webp)
![img_b49b25c75d80669d9e9d8488df056c0d.png](https://yqfile.alicdn.com/img_b49b25c75d80669d9e9d8488df056c0d.png?x-oss-process=image/resize,w_1400/format,webp)
故障转移告警:
![img_e8d2f08f7008ee7db941729f48d1295d.png](https://yqfile.alicdn.com/img_e8d2f08f7008ee7db941729f48d1295d.png?x-oss-process=image/resize,w_1400/format,webp)