Does it possible to run sentinel commands like SENTINEL masters
with python? link is here.
Before using sentinel.master_for("master_name")
, I have to know the master name, however, the redis service I used is provided by company's privite cloud platform, and the master name in sentinel conf contains the ip of current master node and would be rewrited and changed if the master node changed, so hard code it is not possible.
Currently, an idea for me is to sub the channel __sentinel__:hello
and parse the master name from it, however, it looks so uncomfortable.
Is there another way to get master name? In terminal, we could connect to sentinel with redis-cli
and get master info with SENTINEL masters
, could this be done in python?