哨兵命令(Sentinel Commands)

class redis.commands.sentinel.SentinelCommands[源代码]

A class containing the commands specific to redis sentinel. This class is to be used as a mixin.

sentinel(*args)[源代码]

Redis Sentinel's SENTINEL command.

sentinel_ckquorum(new_master_name)[源代码]

Check if the current Sentinel configuration is able to reach the quorum needed to failover a master, and the majority needed to authorize the failover.

This command should be used in monitoring systems to check if a Sentinel deployment is ok.

sentinel_failover(new_master_name)[源代码]

Force a failover as if the master was not reachable, and without asking for agreement to other Sentinels (however a new version of the configuration will be published so that the other Sentinels will update their configurations).

sentinel_flushconfig()[源代码]

Force Sentinel to rewrite its configuration on disk, including the current Sentinel state.

Normally Sentinel rewrites the configuration every time something changes in its state (in the context of the subset of the state which is persisted on disk across restart). However sometimes it is possible that the configuration file is lost because of operation errors, disk failures, package upgrade scripts or configuration managers. In those cases a way to to force Sentinel to rewrite the configuration file is handy.

This command works even if the previous configuration file is completely missing.

sentinel_get_master_addr_by_name(service_name)[源代码]

Returns a (host, port) pair for the given service_name

sentinel_master(service_name)[源代码]

Returns a dictionary containing the specified masters state.

sentinel_masters()[源代码]

Returns a list of dictionaries containing each master's state.

sentinel_monitor(name, ip, port, quorum)[源代码]

Add a new master to Sentinel to be monitored

sentinel_remove(name)[源代码]

Remove a master from Sentinel's monitoring

sentinel_reset(pattern)[源代码]

This command will reset all the masters with matching name. The pattern argument is a glob-style pattern.

The reset process clears any previous state in a master (including a failover in progress), and removes every slave and sentinel already discovered and associated with the master.

sentinel_sentinels(service_name)[源代码]

Returns a list of sentinels for service_name

sentinel_set(name, option, value)[源代码]

Set Sentinel monitoring parameters for a given master

sentinel_slaves(service_name)[源代码]

Returns a list of slaves for service_name