To connect to Redis database clusters from the command line, you need two things:
A Redis client on your local computer. We recommend Redli, a Redis interactive terminal from IBM.
redis-clidoes not support TLS/SSL, but all connections to all DigitalOcean database clusters are encrypted with TLS/SSL to protect your data in transit. There are workarounds, but we recommend Redli for simplicity and ease of use.
The database cluster’s connection details, which tells your client how to connect to the cluster.
You can find a database cluster’s connection details in the control panel. From the Databases page, click the name of the cluster to go to its Overview page.
In the Connection Details section, the drop-down menu has three options:
Connection parameters, which is meant for application configuration and is incompatible with clients like Redli and
Connection string, which is a condensed string that you can pass to a client on the command line.
Flags, which is a complete
redis-cli command that supplies the connection variables as individual flags.
We recommend the flags format because the readability can help if you want to customize the way you connect. The only required parameter is
sslmode, but Redli supports additional options for customizing connections.
By default, the control panel doesn’t reveal the cluster’s password for security reasons. Click Copy to copy connection details with the password, or click show-password to reveal the password.
To connect using the flags format with Redli, paste the entire command from the control panel into your terminal and replace the first term,
redli --tls -h redis-test-do-user-4915853-0.db.ondigitalocean.com -a password -p 25061
When you connect successfully, you arrive at the Redis prompt, which displays the Redis version number:
Connected to 5.0.4 >