Redis Connection Issue with Django in VPS Server

Viewed 192

I have installed redis in the vps (ubuntu server) and able to connect to it using redis-cli command: redis-cli -h ip_address

But when I tried to access apis that uses redis in django it is throwing connection refused error. redis.exceptions.ConnectionError: Error 111 connecting to ip_address:6379. Connection refused.

Enabled firewall in ubuntu using : sudo ufw enable Output of sudo ufw status: 6379 ports enabled

Updated redis.conf files:

bind ip_address protected-mode no

But still facing the issue, Any suggestions are helpfull Thanks in advance

1 Answers

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!

Related