Use Redis with the Command Line

In this example, the Redis Command Line Interface (Redis-cli) will be used to show off some of the possible actions that can be performed with Redis.


The first step is to install the Redis-cli from the official website.  Then load up a command line tool and run the following command,

If you have password authentication enabled:

If you have disabled password authentication:

Where <cluster node IP> is an IP of any of the master nodes in the cluster.

Where <password> is the password for the user you are connecting as. By default instaclustr Redis instances will be created with the user icredis.


Setting and Getting keys.

Incrementing a key.

Setting and Getting multiple keys.

Deleting a key (returns 1 (true) if deleted).

Checking if a key exists (returns 1 if true, 0 if false).

Expiring a key (using 5 seconds) and checking expiration (ttl) returning seconds left before expiration.


Sometimes after authenticating through the Redis-cli, it is possible that running commands still require authentication.  This is due to the Redis-cli switching to a different node to run commands, and therefore requires authentication through that node as well.  To fix this issue, simply provide the authentication again.

Further Reading

The examples above only give basic usage cases for the redis-cli.  For other languages or more advanced usages (such as using lists, hashes, sets etc) please see the official redis documentation.

By Instaclustr Support
Need Support?
Experiencing difficulties on the website or console?
Already have an account?
Need help with your cluster?
Contact Support
Why sign up?
To experience the ease of creating and managing clusters via the Instaclustr Console
Spin up a cluster in minutes