(aio)REDIS wrapper to deal with cluster redirect exceptions (`MOVED`).
Project description
(aio)REDIS wrapper to deal with cluster redirect exceptions MOVED
Handles exceptions like:
redis.exceptions.ResponseError: MOVED 4085 10.213.192.152:6379
When Redis returns a MOVED exception, it indicates that the client should repeat its request for the specified host.
This exception can occur in the following situations:
- Your Redis configuration is incorrect. In this case, you should fix your Redis settings.
redis-redirectcannot help in this scenario. - You are connecting to the wrong host.
For instance, if you're using Amazon managed Redis (ElastiCache), Amazon provides a fixed
DNS name for the configuration node and an IP address for the work node. The IP address may change in the future.
In such cases, you should use the DNS name.
redis-redirectcannot help in this scenario. - You're using a multi-node Redis cluster.
In this case, you can use
redis-redirectto automatically switch between Redis nodes or shards.
redis-redirect handles MOVED exceptions seamlessly and transparently.
Installation
pip install redis-redirect
Usage
import redis_redirect
redis = redis_redirect.Redis(host='my-redis.com', port=6379, db=0)
redis.set('foo', 'bar')
How it works
redis-redirect transparently handles Redis server redirection exceptions.
When a client sends a request to the Redis server, redis-redirect checks if
the server has returned a MOVED exception.
If a MOVED exception is received, redis-redirect updates the Redis server address and resends
the request to the new address.
After updating the Redis server address, redis-redirect transparently forwards subsequent requests to
the new Redis server address.
Coverage report
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_redirect-0.1.9.tar.gz.
File metadata
- Download URL: redis_redirect-0.1.9.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb1fdc103f1defb3f8ded2e32a7335292dc34c29fcaec2563daead5e1efe9858
|
|
| MD5 |
b50c34add9503c4919e04750d223ed9b
|
|
| BLAKE2b-256 |
67d26a1bd9e43a29b90a66a745cb580f190e2b7604ece204a7aaf7a2f37fcac4
|
File details
Details for the file redis_redirect-0.1.9-py3-none-any.whl.
File metadata
- Download URL: redis_redirect-0.1.9-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08c3e5ab7b4962b6d38853591bbd54c40a4e86055c1f259362ae633f8fc23d92
|
|
| MD5 |
643ee06e6140526d77b8f4605506f969
|
|
| BLAKE2b-256 |
d83f88335b283fcd3e590cb611f2e0af312ba14ac46e7fe537c1568c5bbe1a51
|