How to Troubleshoot Redis Database Connectivity Issues

Prerequisites

To troubleshoot issues with Redis on DigitalOcean Managed Databases, you will need to connect to your Redis cluster with a local Redis client. However, the default Redis command line client, redis-cli, does not support TLS/SSL,and all connections to DigitalOcean Redis databases are encrypted with TLS/SSL to protect your data in transit.

Workarounds like tunneling exist, but for simplicity, you can access Redis on DigitalOcean Managed Databases from the command line using redli, a Redis interactive terminal. To do this, you’ll need two things:

  • Redli installed on your local machine, which lets you use the redli command in a terminal.

  • The database’s connection parameters.

Use the Flags format with the redli command, which supplies the variables as individual flags that are easier to read and customize. From the Databases page, open the database’s More menu, then select Connection details and click Flags.

Databases Overview screen showing connection string

Before troubleshooting connection problems, check the DigitalOcean status page for ongoing issues in your database’s region.

Anatomy of the Connection String

The connection string passes different parameters to redli via Flags. Here’s a high-level breakdown of what information those flags correspond to:

  • Hostname and Port: The hostname is specified with the -h flag, and tells your client computer how to reach the cluster. Port is specified with the -p flag. If you do not specify a port, the client will attempt to use the default Redis port, 6379.

  • Password: The password is specified with the -a (or --auth) flag. If you do not use the -a flag, you will have to explicitly use the AUTH command once connected.

  • Encryption: Redis Managed Databases on DigitalOcean require you to connect using SSL/TLS. To do this with redli, specify the encryption with the --tls flag.

  • Other Flags: You can find a more comprehensive list of the flags you can pass to the redli command in the official documentation for redli at Redli - a humane alternative to redis-cli.

Errors

Below are some common Redis database connectivity errors, along with likely causes and solutions. You can find out more information on the different errors in the official redis-cli documentation.

Invalid Password

2019/07/23 11:34:26 Dial ERR invalid password

This error occurs when the password being passed with the -a flag is incorrect. To resolve the issue, double-check the password you’re using.

EOF (End Of File)

2019/07/23 11:38:54 Dial EOF

This error occurs when the command does not contain the --tls flag, or is otherwise unable to encrypt the connection. To troubleshoot this issue, make sure your connection string includes the --tls flag. If it does, check that your local computer’s certificate store is up to date.

Connection Refused

2019/07/23 11:48:17 Dial dial tcp 203.0.113.0:25060: connect: connection refused

This error occurs when the port specified with the -p flag is incorrect. To resolve this issue, make sure you’re specifying the correct port number in the connection string.