How to Connect to Redis Database Clusters with redli Limited Availability

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.

    Note
    The default Redis command line client, redis-cli does 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.

Redis Cluster Connection Details

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.

Databases Overview screen showing connection string

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 redis-cli.

  • 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.

Connecting with Redli

To connect using the flags format with Redli, paste the entire command from the control panel into your terminal and replace the first term, redis-cli, with redli:

  
    
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
>

From here, you can run Redis CLI commands. Learn more about redli on the official redli Github and the IBM Cloud blog. Learn more about redis-cli commands on the official Redis command documentation.