redis-redirect


Nameredis-redirect JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/andgineer/redis-redirect
Summary(aio)REDIS wrapper to deal with cluster redirect exceptions (`MOVED`).
upload_time2024-01-23 08:46:02
maintainer
docs_urlNone
authorAndrey Sorokin
requires_python>=3.8
license
keywords redis asyncio wrapper
VCS
bugtrack_url
requirements async-timeout cffi cryptography hiredis pycparser redis types-pyopenssl types-redis
Travis-CI No Travis.
coveralls test coverage
            [![Build Status](https://github.com/andgineer/redis-redirect/workflows/ci/badge.svg)](https://github.com/andgineer/redis-redirect/actions)
[![Coverage](https://raw.githubusercontent.com/andgineer/redis-redirect/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/andgineer/redis-redirect/blob/python-coverage-comment-action-data/htmlcov/index.html)
# (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
* [Codecov](https://app.codecov.io/gh/andgineer/redis-redirect/tree/master/src%2Fredis-redirect)
* [Coveralls](https://coveralls.io/github/andgineer/redis-redirect)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/andgineer/redis-redirect",
    "name": "redis-redirect",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "redis asyncio wrapper",
    "author": "Andrey Sorokin",
    "author_email": "andrey@sorokin.engineer",
    "download_url": "https://files.pythonhosted.org/packages/5b/a8/f5e1cab76e4148b9bdacc06b7a280a27ad28a90f7945f5d968e5f2617494/redis-redirect-0.1.5.tar.gz",
    "platform": null,
    "description": "[![Build Status](https://github.com/andgineer/redis-redirect/workflows/ci/badge.svg)](https://github.com/andgineer/redis-redirect/actions)\n[![Coverage](https://raw.githubusercontent.com/andgineer/redis-redirect/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/andgineer/redis-redirect/blob/python-coverage-comment-action-data/htmlcov/index.html)\n# (aio)REDIS wrapper to deal with cluster redirect exceptions `MOVED`\n\nLike\n\n        redis.exceptions.ResponseError: MOVED 4085 10.213.192.152:6379\n\nWhen Redis returns a MOVED exception, it indicates that the client should repeat its request for the specified host.\n\nThis exception can occur in the following situations:\n\n1) Your Redis configuration is incorrect. In this case, you should fix your Redis settings,\n`redis-redirect` cannot help you in this scenario.\n2) You are connecting to the wrong host.\nFor instance, if you're using Amazon managed Redis (ElastiCache), Amazon provides a fixed\nDNS name for the configuration node and an IP address for the work node. The IP address may change in the future.\nIn such cases, you should just use the DNS name, `redis-redirect` cannot help you in this scenario.\n3) You're using a multi-node Redis cluster.\nIn this case, you can use the `redis-redirect` to automatically switch between Redis nodes or shards.\n\nThe `redis-redirect` is designed to handle `MOVED` exceptions seamlessly and transparently.\n\n# Installation\n\n        pip install redis-redirect\n\n# Usage\n\n        import redis_redirect\n\n        redis = redis_redirect.Redis(host='my-redis.com', port=6379, db=0)\n        redis.set('foo', 'bar')\n\n\n# How it works\n\nThe `redis-redirect` is designed to transparently handle Redis server redirection exceptions.\n\nWhen a client sends a request to the Redis server, the `redis-redirect` checks if\nthe server has returned a `MOVED` exception.\n\nIf a `MOVED` exception is received, the `redis-redirect` updates the address of the Redis server and resends\nthe request to the new address.\n\nAfter the `redis-redirect` updates the Redis server address, it transparently forwards subsequent requests to\nthe new Redis server address.\n\n## Coverage report\n* [Codecov](https://app.codecov.io/gh/andgineer/redis-redirect/tree/master/src%2Fredis-redirect)\n* [Coveralls](https://coveralls.io/github/andgineer/redis-redirect)\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "(aio)REDIS wrapper to deal with cluster redirect exceptions (`MOVED`).",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/andgineer/redis-redirect"
    },
    "split_keywords": [
        "redis",
        "asyncio",
        "wrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d6e757cd5bf165f5137bfab642ca57ea5c3e92e40da2553d9f17758b6b2658e",
                "md5": "fc7b143c2b8af8e0d140db6306e646de",
                "sha256": "25e297f4c8c53be214ee26bb378aac20f93d77507ed31a1e02f0a1b88a4ce82b"
            },
            "downloads": -1,
            "filename": "redis_redirect-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fc7b143c2b8af8e0d140db6306e646de",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 3053,
            "upload_time": "2024-01-23T08:46:01",
            "upload_time_iso_8601": "2024-01-23T08:46:01.098360Z",
            "url": "https://files.pythonhosted.org/packages/5d/6e/757cd5bf165f5137bfab642ca57ea5c3e92e40da2553d9f17758b6b2658e/redis_redirect-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ba8f5e1cab76e4148b9bdacc06b7a280a27ad28a90f7945f5d968e5f2617494",
                "md5": "a0a37c629b6d5a00d3c2c19715b7ba6f",
                "sha256": "681444f42347bf4c74c5a258f948f3a06fca8cd61527c158ac01a21873daedd9"
            },
            "downloads": -1,
            "filename": "redis-redirect-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a0a37c629b6d5a00d3c2c19715b7ba6f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3915,
            "upload_time": "2024-01-23T08:46:02",
            "upload_time_iso_8601": "2024-01-23T08:46:02.233991Z",
            "url": "https://files.pythonhosted.org/packages/5b/a8/f5e1cab76e4148b9bdacc06b7a280a27ad28a90f7945f5d968e5f2617494/redis-redirect-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-23 08:46:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "andgineer",
    "github_project": "redis-redirect",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "async-timeout",
            "specs": [
                [
                    "==",
                    "4.0.3"
                ]
            ]
        },
        {
            "name": "cffi",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        },
        {
            "name": "cryptography",
            "specs": [
                [
                    "==",
                    "42.0.0"
                ]
            ]
        },
        {
            "name": "hiredis",
            "specs": [
                [
                    "==",
                    "2.3.2"
                ]
            ]
        },
        {
            "name": "pycparser",
            "specs": [
                [
                    "==",
                    "2.21"
                ]
            ]
        },
        {
            "name": "redis",
            "specs": [
                [
                    "==",
                    "5.1.0b3"
                ]
            ]
        },
        {
            "name": "types-pyopenssl",
            "specs": [
                [
                    "==",
                    "23.3.0.20240106"
                ]
            ]
        },
        {
            "name": "types-redis",
            "specs": [
                [
                    "==",
                    "4.6.0.20240106"
                ]
            ]
        }
    ],
    "lcname": "redis-redirect"
}
        
Elapsed time: 0.16862s