How to connect to remote Redis server?
I have URL and PORT of remote Redis server. I am able to write into Redis from Scala. However I want to connect to remote Redis via terminal using
redis-server or something similar in order to make several call of
get, etc. (I can do it with my locally installed Redis without any problem).
redis-cli -h XXX.XXX.XXX.XXX -p YYYY
xxx.xxx.xxx.xxx is the IP address and
yyyy is the port
EXAMPLE from my dev environment
redis-cli -h 10.144.62.3 -p 30000
Host, port, password and database By default redis-cli connects to the server at 127.0.0.1 port 6379. As you can guess, you can easily change this using command line options. To specify a different host name or an IP address, use -h. In order to set a different port, use -p.
redis-cli -h redis15.localnet.org -p 6390 ping
How to connect to remote Redis server?, The prompt changes as the server you are connected to changes, or when you are operating on Transferring RDB backups from a remote Redis server locally. To connect to Redis from a different machine, you must open port for remote access. Refer to the FAQ for more information on this. You can now connect to Redis using a command like the one below. Replace the YOURPASSWORD placeholder with the value of your password: redis-cli -h SERVER-IP -a YOURPASSWORD. In this article.
In Case of password also we need to pass one more parameter
redis-cli -h host -p port -a password
redis-cli, the Redis command line interface – Redis, Whether you've installed Redis locally or you're working with a remote instance, you If you have redis-server installed locally, you can connect to the Redis As good security practice redis by default does not allow remote client to connect to the server. This configuration can be overridden with following steps. Get Public IP Address of Redis Server You can use command like ifconfigon linux and ipconfigon windows to find IP address of your server.
There are two ways to connect remote redis server using
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
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
184.108.40.206 is the host IP address and
6379 is the port:
redis-cli -h 220.127.116.11 -p 6379
command if the instance is protected with password
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://email@example.com:6379
command if username is also provided
redis-cli -u redis://user123:firstname.lastname@example.org:6379
This detailed answer was for those who wants to check all options. For more information check documentation: Redis command line usage
How To Connect to a Redis Database, /usr/local/bin/redis-server 127.0.0.1 and using redis-cli will show 127.0.0.1> . I thus think that Redis doesn't correctly bind to 0.0.0.0 and am I have installed redis on an independent database server(ec2 instance). And it has been installed and configured properly. Now all that I want to do is from my webserver, I connect to it, and make changes to its key value store.
Enable remote Redis connection, Follow these instructions to remotely connect safely and reliably. To connect to Redis from a redis-cli -h SERVER-IP -a YOURPASSWORD Replaced bind 127.0.0.1 with bind 0.0.0.0 in the /etc/redis/redis.conf file, the line does not have a leading # nor space, Replaced protected-mode yes with protected-mode no in this same file, Allowed all traffic to port 6379 using ufw allow 6379 and ufw allow 6379/tcp; But I can’t get it to work.
Connect to Redis from a different machine, Redis-cli also gives you options to connect to a Redis endpoint Case 2: Redis is running remotely (example: 192.168.0.10) If you cannot connect to the Redis server for some reason, then Open $REDIS_HOME/redis.conf and uncomment requirepass -YOUR-PASSWORD-HERE- and write down your password in the specified lines. Login to redis using redis-cli and verify your password in the database using auth -YOUR-PASSWORD-HERE- command. Disable protected mode by changing its string in $REDIS_HOME/redis.conf to protected-mode no.
Get Started with Redis, Example. Following example shows how to connect to Redis remote server, running on host 127.0.0.1, port 6379 and has password mypass. $redis Here is what I'm using to remotely connect to the Redis server: visitingServer$ redis-cli -h 192.168.xxx.xx -p 6379 -a "password" Please sign in or create an account to participate in this conversation.