42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
# Redis Sentinel 配置
|
|
# 所有节点使用相同配置
|
|
|
|
port 26379
|
|
daemonize no
|
|
pidfile /var/run/redis/redis-sentinel.pid
|
|
# 日志输出到标准输出(Docker容器标准做法)
|
|
logfile ""
|
|
dir /tmp
|
|
|
|
# 监控主节点配置
|
|
# sentinel monitor <master-name> <ip> <redis-port> <quorum>
|
|
# quorum: 需要多少个sentinel同意才能判断主节点客观下线
|
|
sentinel monitor mymaster 192.168.1.101 6379 2
|
|
|
|
# 主节点密码
|
|
sentinel auth-pass mymaster redis_HA_Cluster_2024
|
|
|
|
# 主观下线时间 (毫秒)
|
|
# 如果主节点在这个时间内没有响应PING,则标记为主观下线
|
|
sentinel down-after-milliseconds mymaster 30000
|
|
|
|
# 故障转移超时时间 (毫秒)
|
|
sentinel failover-timeout mymaster 180000
|
|
|
|
# 同时可以有多少个从节点对新主节点进行同步
|
|
sentinel parallel-syncs mymaster 1
|
|
|
|
# 通知脚本 (可选)
|
|
# sentinel notification-script mymaster /var/redis/notify.sh
|
|
|
|
# 客户端重配置脚本 (可选)
|
|
# sentinel client-reconfig-script mymaster /var/redis/reconfig.sh
|
|
|
|
# 允许Sentinel在启动时更新配置文件
|
|
# sentinel announce-ip <ip>
|
|
# sentinel announce-port <port>
|
|
|
|
# 其他配置
|
|
protected-mode no
|
|
bind 0.0.0.0
|