redis-py icon indicating copy to clipboard operation
redis-py copied to clipboard

Connection closed by server errors

Open rishindoshi opened this issue 3 years ago • 0 comments

django v3.2.11, python 3.9.9, macOS 12.1

Hey everyone hope you're doing well!

I have a Django application on v3.2.11 and I'm trying to hook it up to a redis cache using this package. Testing the application with a local instance of redis works perfectly, but when trying to connect to a remote redis instance I have hosted on Digital Ocean, I keep getting the "Connection close by server" error.

My settings.py cache config is set up as follows:

CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        'LOCATION': (
            'redis://<user>:<password>'
            '@discz-staging-redis-do-user-10516625-0.b.db.ondigitalocean.com:25061'
        ),
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
        }
    }
}

Another thing of note is that I'm able to connect to the remote redis instance via redis-cli, but only if I add the --tls option. If I don't run it with --tls, then I get the same "Connection closed by server" error on the command line.

Any help on this would be much appreciated!

rishindoshi avatar Mar 18 '22 16:03 rishindoshi