Last active
June 30, 2020 11:14
-
-
Save sayuj1/b3e34c88ed5754c3146d7a84d2fbb46d to your computer and use it in GitHub Desktop.
Commands to connect redis server both locally/cloud hosted using redis-cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are two ways to connect remote redis server using redis-cli: | |
1. Using host & port individually as options in command | |
redis-cli -h host -p port | |
If your instance is password protected | |
redis-cli -h host -p port -a password | |
e.g. if my-web.cache.amazonaws.com is the host url and 6379 is the port | |
Then this will be the command: | |
redis-cli -h my-web.cache.amazonaws.com -p 6379 | |
if 92.101.91.8 is the host IP address and 6379 is the port: | |
redis-cli -h 92.101.91.8 -p 6379 | |
command if the instance is protected with password pass123: | |
redis-cli -h my-web.cache.amazonaws.com -p 6379 -a pass123 | |
2. Using single uri option in command | |
redis-cli -u redis://password@host:port | |
command in a single uri form with username & password | |
redis-cli -u redis://username:password@host:port | |
e.g. for the same above host - port configuration command would be | |
redis-cli -u redis://pass123@my-web.cache.amazonaws.com:6379 | |
command if username is also provided user123 | |
redis-cli -u redis://user123:pass123@my-web.cache.amazonaws.com:6379 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment