三个交互演示:① 故障转移全流程动画 · ② SDOWN vs ODOWN 判定 · ③ Sentinel 配置解读器
点「主节点宕机」按钮,观察哨兵如何 PING 超时 → 互相确认 → 选 Leader → 选新主 → 重排从节点 → 通知客户端。每一步都有文字解说和事件流。
下面 5 个哨兵分别监控同一个主节点。点「我觉得主死了」切换它的 SDOWN 视角。当「认为主下线的哨兵数 ≥ quorum」时,主节点状态升级为 ODOWN,故障转移流程被触发。
quorum(判 ODOWN 的票数)和 majority = ⌊N/2⌋+1(选 Leader 的票数)是两件事。
quorum 可小可大,但 ODOWN 触发后真正发起 failover 还需要满足 majority。左边编辑配置(默认放了一份生产可用模板),右边即时解析每一行的含义。能识别的指令会高亮,配错值会红色警告。
port · dir · sentinel monitor · sentinel down-after-milliseconds · sentinel parallel-syncs · sentinel failover-timeout · sentinel auth-pass · sentinel notification-script · sentinel client-reconfig-script · sentinel deny-scripts-reconfig · sentinel resolve-hostnames · sentinel announce-ip · sentinel announce-port