In Real time, Redis server is hosted in remote cloud or external .
You can connect using remote url in client libraries or from terminal.
Let’s see how to connect to remtoe redis server using terminal..
How to connect to remote redis server?
redis-cli provides an options to connect to remote redis server.
Syntax
redis-cli [options]
redis-cli has following options
-h - hostname, default is 127.0.0.1
-p: server port, default port is 6379
-a: server password
-u: Server url in th format - redis://username:password@hostname:port
For example, if an redis server is hosted in amazon cloud, you can give
redis-cli -h ch123.cache.amazonaws.com -p 6379
if instance is secured with password, you can give -a
option
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