How to Connect to Redis Database Clusters

Redis is an open source, key-value database built with an in-memory design that emphasizes speed. It has support for rich data types, atomic operations, and Lua scripting.

You can connect to DigitalOcean Managed Databases using command line tools and other third-party clients. This guide explains where to find your Redis database’s connection details and how to use them to configure tools and clients.

This method uses Let’s Encrypt certification, which does not require that you download a CA certificate in order to connect.

View Redis Cluster Connection Details

You use your database’s connection details to configure tools, applications, and resources that connect to the database. To view your database’s connection details, click the name of the cluster on the Databases page to go to its Overview page.

Databases Overview screen showing connection string

You can view customized connection details based on whether you want to connect using the cluster’s public or private network (VPC) interface. The Public network and Private network options generate connection details based on if you want to connect via the cluster’s public hostname or the cluster’s private hostname. Only other resources in the same VPC network as the cluster can access it using its private hostname.

You can also choose to view the connection details in three different formats:

  • Connection parameters: Database information meant for application configuration, such as configuring connections for Redsmin and Redis Desktop Manager.

  • Connection string: A condensed string that you can pass to a client on the command line.

  • Flags: A complete redli 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.

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.

Anatomy of the Flags Format

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

Connect to the Database

To connect to Redis database clusters from the command line, you need three things:

  • To add your local computer to the database’s trusted sources.

  • To install a Redis client on your local computer. We recommend Redli, a Redis interactive terminal from IBM.

    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.
  • To reference the database cluster’s connection details, which tells your client how to connect to the cluster.

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 -a your_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.

If you’re having trouble connecting to the database, you can troubleshoot the connection using our Support page, or you can reference Redli’s connection documentation.