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

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 you 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 just use the DNS name, redis-redirect cannot help you in this scenario.
  3. You're using a multi-node Redis cluster. In this case, you can use the redis-redirect to automatically switch between Redis nodes or shards.

The redis-redirect is designed to handle 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

The redis-redirect is designed to transparently handle Redis server redirection exceptions.

When a client sends a request to the Redis server, the redis-redirect checks if the server has returned a MOVED exception.

If a MOVED exception is received, the redis-redirect updates the address of the Redis server and resends the request to the new address.

After the redis-redirect updates the Redis server address, it 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.6.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

redis_redirect-0.1.6-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file redis_redirect-0.1.6.tar.gz.

File metadata

  • Download URL: redis_redirect-0.1.6.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for redis_redirect-0.1.6.tar.gz
Algorithm Hash digest
SHA256 87528e3e0a1de2acd8ef622cc9384eedd6693b02244bff4148353b8a3cf75f53
MD5 979b76b652041e520af9fdf2c4613e03
BLAKE2b-256 ae1d5176a9f3184e66c10b0a0f152e17b70740cc82b7047bef827ef985700114

See more details on using hashes here.

File details

Details for the file redis_redirect-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for redis_redirect-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9975c91a7f20635c2b5d51cf0f4eb4a1e2f97be4dc3ecc17fba15e0335f9f75d
MD5 67925a53506c339cf9de7ed11356b07b
BLAKE2b-256 2786611ee8781ba5cabca8d04143efdbca14137451cc302208c72055bbe7264c

See more details on using hashes here.

Supported by

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