I\'ve just install Redis succesfully using the instructions on the Quick Start guide on http://redis.io/topics/quickstart on my Ubuntu 10.10 server. I\'m running the service
Orabig is correct.
You can bind 10.0.2.15 in Ubuntu (VirtualBox) then do a port forwarding from host to guest Ubuntu.
in /etc/redis/redis.conf
bind 10.0.2.15
then, restart redis:
sudo systemctl restart redis
It shall work!
I've been stuck with the same issue, and the preceding answer did not help me (albeit well written).
The solution is here : check your /etc/redis/redis.conf
, and make sure to change the default
bind 127.0.0.1
to
bind 0.0.0.0
Then restart your service (service redis-server restart
)
You can then now check that redis is listening on non-local interface with
redis-cli -h 192.168.x.x ping
(replace 192.168.x.x with your IP adress)
Important note : as several users stated, it is not safe to set this on a server which is exposed to the Internet. You should be certain that you redis is protected with any means that fits your needs.
In addition to the excellent answer given by Orabîg:
I resolved this issue by removing the bind
section entirely and setting protected-mode
to no
.
#bind 127.0.0.1
protected-mode no
Never use this method on publicly exposed servers.
if you downloaded redis yourself (not apt-get install redis-server) and then edited the redis.conf with
the above suggestions, make sure your start redis with the config
like so: ./src/redis-server redis.conf
Setting tcp-keepalive to 60 (it was set to 0) in server's redis configuration helped me resolve this issue.
First I'd check to verify it is listening on the IPs you expect it to be:
netstat -nlpt | grep 6379
Depending on how you start/stop you may not have actually restarted the instance when you thought you had. The netstat will tell you if it is listening where you think it is. If not, restart it and be sure it restarts. If it restarts and still is not listening where you expect, check your config file just to be sure.
After establishing it is listening where you expect it to, from a remote node which should have access try:
redis-cli -h REMOTE.HOST ping
You could also try that from the local host but use the IP you expect it to be listening on instead of a hostname or localhost. You should see it PONG in response in both cases.
If not, your firewall(s) is/are blocking you. This would be either the local IPTables or possibly a firewall in between the nodes. You could add a logging statement to your IPtables configuration to log connections over 6379 to see what is happening. Also, trying he redis ping from local and non-local to the same IP should be illustrative. If it responds locally but not remotely, I'd lean toward an intervening firewall depending on the complexity of your on-node IP Tables rules.