Redis Sentinel 的支持

我认为这从未奏效过。

只需将高可用 Redis 的关注点从 Discourse 中分离出来,并使用 HAProxy 将流量导向主节点或从节点。

示例配置(主节点在 6379,从节点在 6380)

listen redis_master
  bind 127.0.0.1:6379
  timeout client 30h
  timeout server 30h
  option tcp-check
  tcp-check connect
  tcp-check send AUTH\ *redis_password*\r\n
  tcp-check expect string +OK
  tcp-check send PING\r\n
  tcp-check expect string +PONG
  tcp-check send info\ replication\r\n
  tcp-check expect string role:master
  tcp-check send QUIT\r\n
  tcp-check expect string +OK
  server redis_data_0 10.10.10.10:6379 check inter 1s
  server redis_data_1 10.10.10.11:6379 check inter 1s

listen redis_slave
  bind 127.0.0.1:6380
  timeout client 30h
  timeout server 30h
  option tcp-check
  tcp-check connect
  tcp-check send AUTH\ *redis_password*\r\n
  tcp-check expect string +OK
  tcp-check send PING\r\n
  tcp-check expect string +PONG
  tcp-check send info\ replication\r\n
  tcp-check expect string role:slave
  tcp-check send QUIT\r\n
  tcp-check expect string +OK
  server redis_data_0 10.10.10.10:6379 check inter 1s
  server redis_data_1 10.10.10.11:6379 check inter 1s
4 个赞