Could be that remote connections are disabled. Enable it on your own risk, make sure you read warning bellow!
You can check redis.conf
to verify is it enabled. There are to relevant settings, bind
- by default it only allows connections from local, and protected-mode
that makes Redis to reply only on queries from loopback interfaces.
To enable it, first open the conf file:
- sudo nano /etc/redis/redis.conf
For start find bind
line. By default, it should be bind 127.0.0.1
. To allow access from everywhere, you have to change it to bind 0.0.0.0
.
Next one is protected-mode
. To enable remote connections set it to no
: protected-mode no
.
Also, make sure lines are not commented, i.e. it doesn’t have `# in front of it.
You are ready to save file and exit editor. To make changes in effect Redis restart is required:
- sudo systemctl restart redis
But please, be EXTREMLY CAREFUL! This is very dangerous, you must consider implementing AUTH method of if not, you are exposing your Redis instance to everyone on the Internet. As I said, it’s extremely dangerous to change above config, but if you have to do so, at least implement Auth. This Redis blog post can be helpful. Do it on your own risk!