Redis and redis-cli
You will usually be using the
redis-cli command to manually connect to the deployment - it's the most direct way to remotely work with your Redis installation. It comes as part of the Redis package, so you will need to have Redis installed locally to use it. On Mac OS X we recommend installing brew and then using
brew install redis to get up and running. On Linux, refer to your distributions package manager for the latest build or, if you are so inclined, download the source and build it yourself.
Using redis-cli over TCP
Take the TCP Command Line and cut and paste it into your terminal like so:
$ redis-cli -h portal.brilliant-redis-41.compose-3.composedb.com -p 15639 -a secretpassword $ portal.brilliant-redis-41.compose-3.composedb.com:15639> set hello "world" > OK $ portal.brilliant-redis-41.compose-3.composedb.com:15639> get hello > "world"
You can test your connection by running some simple Redis commands as shown.
Using redis-cli with SSL/TLS
It is possible to use the redis-cli over an SSL/TLS secured connection using the stunnel utility to handle the encryption. The steps to get it up and running are:
- Install stunnel.
- Add the redis-cli to stunnel.conf
- Run stunnel.
- Run redis-cli
Use your package manager for Linux, Homebrew for Mac, or grab a download appropriate for your platform.
Set the local connection and port, along with your deployment's connection string, in the stunnel.conf file.
[redis-cli] client=yes accept=127.0.0.1:6830 connect=adept-redis-42.compose-34.composedb.com:24026
If your deployment has a self-signed certificate, you will want to add certificate information to the stunnel.conf file:
[redis-cli] client=yes accept=127.0.0.1:6830 connect=adept-redis-42.compose-34.composedb.com:24026 verify=2 checkHost=adept-redis-42.compose-34.composedb.com CAfile=/path/to/redis/cert.crt
stunnel command at the command-line. It will immediately run in the background.
Using the local host and port, and authenticate with the deployment's credentials.
redis-cli -p 6830 -a your-redis-password
Still Need Help?
If this article didn't solve things, summon a human and get some help!
Updated over 3 years ago