Report this

What is the reason for this report?

Error: Server closed the connection

Posted on February 19, 2020

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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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

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

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.REDIS_HOST, port: process.env.REDIS_PORT, password: process.env.REDIS_PASSWORD, TLS: true });

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.