Every time I start my redis cluster and connect to it, I get this error when trying to run any command.
Error: Server closed the connection

1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
4 answers

Hey,

What client are you using to connect? As mentioned in our documentation, the official redis-cli client does not yet support TLS, which is required to connect to our managed redis. With that in mind, we suggest connecting using redli, which does support TLS and has been tested to work properly with our managed redis.

Best,
Eris
Customer Success Engineer

For anyone who lands on this page with connection issues using Node to connect to a DO Redis DB, TLS is required. You can use the URL method to connect which is redis with 2 s’s…

rediss://....

or construct the connection and set TLS to true.

const client = redis.createClient({
host: process.env.REDISHOST,
port: process.env.REDIS
PORT,
password: process.env.REDIS_PASSWORD,
TLS: true
});

Hello, @vikramkh

Could you please let me know if this is a new Redis cluster setup or your working/production setup has suddenly started throwing this error?

Also you can check the redis error log in order to track down any errors as they might help you to sort the issue. Feel free to paste any logged errors here so we can check them.

Let me know how it goes.

Regards,
Alex

From some reason my rq workers started failing with ‘cannot unpack, value too large’ issue that I cannot figure out for redis.Redis() connection, so I ended up using redis.from_url per their documentation:

https://redislabs.com/lp/python-redis/

For redis-py:

import redis

redis.from_url(url='your public/private connection string starting with 'rediss://’ along with un/pw as applicable’)

and then the rq worker with a -u flag with the public/private url