Open Redis port for remote connections
Bind & protected-mode both are the essential steps. But if ufw is enabled then you will have to make redis port allow in ufw.
- Check ufw status
ufw status
ifStatus: active
then allow redis-portufw allow 6379
vi /etc/redis/redis.conf
- Change the
bind 127.0.0.1
tobind 0.0.0.0
- change the
protected-mode yes
toprotected-mode no
Did you set the bind option to allow remote access on the redis server?
Before (file /etc/redis/redis.conf
)
bind 127.0.0.1
After
bind 0.0.0.0
and run sudo service redis-server restart
to restart the server. If that's not the problem, you might want to check any firewalls that might block the access.
Important: If you don't use a firewall (iptables, ufw..) to control who connects to the port in use, ANYONE can connect to this Redis instance. Without using Redis' AUTH
that means anyone can access/change/delete your data. Be safe!
For me, I needed to do the following:
1- Comment out bind 127.0.0.1
2- Change protected-mode
to no
3- Protect my server with iptables
(https://www.digitalocean.com/community/tutorials/how-to-implement-a-basic-firewall-template-with-iptables-on-ubuntu-14-04)