Redis connection fully managed by sentinel
Project description
Python Redis Sentinel
Given a Redis + Sentinel service, this package allow you to connect simultaneously to both the master node and to the slave nodes, transparently balancing the connection used to the user.
Scope
The redis packages doesn't expose a tool to automatically choose between the master node and the slaves ones. With this package, you get an object that automatically detect when to use the master one and when to connect to the slaves.
This is useful for the scenarios when you need to expose a Redis connection, you need to execute read and write operation, but you want also take advantage of the read only nodes
Mechanism
The automatic selection between master and slaves is detected by the Redis command executed:
into the class, there is an attribute (REPLICAS_COMMANDS) which contain the list of Redis' commands that will be executed on the slaves connection pool.
Those commands which are not listed in REPLICAS_COMMANDS are executed on the master node.
The main idea is to use the slave for the read operations (such as GET, KEYS ecc...) and to use the master just for the writes.
Usage
Instantiate RedisSentinel passing a redis.sentinel.Sentinel instance, the service name,
and every connection parameter you would pass to the redis.Redis constructor (excepts obviously the host and the port, which are given by Sentinel)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redis-sentinel-1.0.1.tar.gz.
File metadata
- Download URL: redis-sentinel-1.0.1.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13afccb6334f91434632f37ae9a003c1d91cb7d6ddf54abe3b2af3c955e9f50e
|
|
| MD5 |
22c655a24864cdbd23b791e6390747d1
|
|
| BLAKE2b-256 |
272ce03b50fd6709546cd7285de556ac943a2e0fb5ded86cd275269868c161f0
|
File details
Details for the file redis_sentinel-1.0.1-py3-none-any.whl.
File metadata
- Download URL: redis_sentinel-1.0.1-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d735aa93a7d0ff9c186cbb10ce9979d23ef5e8e83de65cfb1bfeb54119f34750
|
|
| MD5 |
d316e0a92537a16ad3dac94a378afb15
|
|
| BLAKE2b-256 |
ecab8d2b41fb8288ceff9e15c5f265e0803865c8c4a9179758f8b84587bf5af8
|