To allow Redis connections on DigitalOcean, you need to follow these steps:
-
Check if Redis is running: Run the following command in your terminal to check if Redis is running on your server:
redis-cli pingIf you get a response of "PONG," it means Redis is running.
-
Check the Redis configuration file: Open the Redis configuration file using the following command:
sudo nano /etc/redis/redis.confLook for the
binddirective and make sure it is set tobind 127.0.0.1. This allows Redis to listen for connections on the localhost. -
Check the firewall settings: Run the following command to check the firewall settings:
sudo ufw statusIf the firewall is active, you need to allow incoming connections on port 6379 by running the following command:
sudo ufw allow 6379 -
Restart Redis and the firewall: After making any changes, restart Redis and the firewall by running the following commands:
sudo systemctl restart redis sudo ufw reload -
Test the connection: Try connecting to Redis again using the
redis-cli pingcommand. If you get a response of "PONG," it means the connection is successful.
If you still encounter issues, make sure that your Redis client is configured correctly to connect to the correct IP address and port.
Note: The IP address mentioned in the error message (144.126.238.112) is just an example and may not be the actual IP address of your server. Make sure to use the correct IP address when configuring your Redis client.