Skip to main content

(aio)REDIS wrapper to deal with cluster redirect exceptions (`MOVED`).

Project description

Build Status Coverage

(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:

  1. Your Redis configuration is incorrect. In this case, you should fix your Redis settings. redis-redirect cannot help in this scenario.
  2. 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-redirect cannot help in this scenario.
  3. You're using a multi-node Redis cluster. In this case, you can use redis-redirect to 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redis_redirect-0.1.9.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redis_redirect-0.1.9-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

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

Hashes for redis_redirect-0.1.9.tar.gz
Algorithm Hash digest
SHA256 fb1fdc103f1defb3f8ded2e32a7335292dc34c29fcaec2563daead5e1efe9858
MD5 b50c34add9503c4919e04750d223ed9b
BLAKE2b-256 67d26a1bd9e43a29b90a66a745cb580f190e2b7604ece204a7aaf7a2f37fcac4

See more details on using hashes here.

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

Hashes for redis_redirect-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 08c3e5ab7b4962b6d38853591bbd54c40a4e86055c1f259362ae633f8fc23d92
MD5 643ee06e6140526d77b8f4605506f969
BLAKE2b-256 d83f88335b283fcd3e590cb611f2e0af312ba14ac46e7fe537c1568c5bbe1a51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page