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.10.tar.gz (7.3 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.10-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: redis_redirect-0.1.10.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for redis_redirect-0.1.10.tar.gz
Algorithm Hash digest
SHA256 888e1f36edc0376fa739fc090582712a798f5fabbf830f8e1d50e70092174800
MD5 c890edb596bb25e5c939f53962fe93cb
BLAKE2b-256 eff8353fa97b2c91ee9d56835c23699254fe8430962fc3f901b3bb8e78b41ce3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_redirect-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 15862efaae934191ce9ff050d6f3d445577a92e02874590f2069f38492c570d3
MD5 e46f0cb96efe2760d1b0c401501839a8
BLAKE2b-256 6391b690ef092d4f0a76ed5591cc65bc121b523c541ab15b88dcbea3ca041db6

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