In Real-time, the Redis server is hosted in a remote cloud or external.
You can connect using a remote url in client libraries or from the terminal.
Let’s see how to connect to the remote redis server using the terminal.
How to connect to remote redis server?
redis-cli provides an option to connect to a remote redis server.
Redis-cli has the following options
-h - hostname, default is 127.0.0.1
-p: server port, the default port is 6379
-a: server password
-u: Server url in the format -
For example, if a Redis server is hosted in the Amazon cloud, you can give
redis-cli -h ch123.cache.amazonaws.com -p 6379
if the instance is secured with a password, you can give the
redis-cli -h ch123.cache.amazonaws.com -p 6379 -a password
Similarly, You can also connect using single url
url is a combination of string Redis, username, password, hostname, and port.
redis-cli -u redis://username:password@host:port