redis_cluster¶
Redis cluster module.
-
exception
spicerack.redis_cluster.
RedisClusterError
[source]¶ Bases:
spicerack.exceptions.SpicerackError
Custom exception class for errors in the RedisCluster class.
-
class
spicerack.redis_cluster.
RedisCluster
(cluster: str, config_dir: str, *, dry_run: bool = True)[source]¶ Bases:
object
Class to manage a Redis Cluster.
Initialize the instance.
- Parameters
-
class
spicerack.redis_cluster.
RedisInstance
(**kwargs: Any)[source]¶ Bases:
object
Class to manage a Redis instance, a simple wrapper around redis.StrictRedis.
Initialize the instance.
- Parameters
**kwargs (mixed) -- arbitrary keyword arguments, to be passed to the redis.StrictRedis constructor.
-
start_replica
(master: spicerack.redis_cluster.RedisInstance) → None[source]¶ Start the replica from the given master instance.
- Parameters
master (spicerack.redis_cluster.RedisInstance) -- the master instance.
-
property
info
¶ Getter to know the detail of this instance.
- Returns
a 2-element tuple with (host/IP, port) of the instance.
- Return type
-
property
is_master
¶ Getter to check if the current instance is a master.