获得redis大师哨兵

时间:2017-09-06 11:26:49

标签: redis redis-sentinel

我正在尝试获取目前正在监控redis master的所有哨兵列表。

我知道如果我有一个哨兵,我可以使用sentinel sentinels mymaster,但如果我没有任何Sentinel地址,我怎么能得到它们?

2 个答案:

答案 0 :(得分:1)

没有直接命令从主/从节点获取标记列表。要获得哨兵列表,您需要订阅任何节点的pub / sub(主要或从属无关紧要)“__sentinel __:hello”频道并等待消息。通过该hello通道的消息来自正在侦听该群集的标记。如果你解析那些,你会得到哨兵的地址。消息的格式为:“sentinel_ip,sentinel_port,sentinel_runid,sentinel_current_epoch,master_name,master_ip,master_port,master_config_epoch”(例如127.0.0.1,26380,07fabf3cbac43bcc955588b1023f95498b58f8f2,16,mymaster,127.0.0.1,6381,16)。请参阅:https://redis.io/topics/sentinel#sentinels-and-slaves-auto-discovery了解有关哨兵的详细信息。如果您需要了解有关哨兵如何运作的更多信息,请查看https://github.com/antirez/redis/blob/unstable/src/server.c

答案 1 :(得分:0)

为了进一步了解此实例,您可能需要尝试以下两个命令:

sudo chown www-data:www-data /var/lib/wordpress/wp-content/ -R

https://redis.io/topics/sentinel#asking-sentinel-about-the-state-of-a-master