示例配置
示例配置
port 26379
sentinel monitor mymaster 10.0.0.10 6379 2
sentinel auth-pass mymaster 主库密码
sentinel down-after-milliseconds mymaster 30000
sentinel failover-timeout mymaster 180000
sentinel parallel-syncs mymaster 1
dir /var/lib/redis-sentinel
logfile /var/log/redis/sentinel.log
# 同机区分实例:
# sentinel announce-ip 10.0.0.11
# sentinel announce-port 26379| quorum=2 | 至少 2 个哨兵同意才判定 odown |
|---|---|
| down-after=30000 | 30 秒无响应判 sdown |
| failover-timeout | 切换各阶段超时与重试间隔 |
| parallel-syncs=1 | 故障后逐个重同步,避免全量风暴 |
sentinel monitor 行只能出现在启动时(或 CONFIG 修改后 rewrite);运行时动态加监控用 SENTINEL MONITOR 命令并 flushconfig。