How to solve redis error Connection refused: no further information

Today when I was using redis, I got the error Connection refused: no further information, so I checked the configuration file. Now I will share the solution with you.

This error usually means that the connection to the Redis server cannot be established, possibly due to some configuration or network issues.

First, we need to check whether the Redis service on the server is running. We can check this with the following command:

$ ps -ef | grep redis-server

If there is no output, the Redis service may not be started. We can use the following command to start the Redis service:

$ redis-server

Next, we need to ensure that the address and port of Redis are configured correctly. Open the Redis configuration file (redis.conf) and look for the following lines:

bind 127.0.0.1
port 6379

Please ensure that bind is configured to the correct IP address of the server and port is configured to the correct port number. If modifications are required, save the file and restart the Redis service.

If the Redis address and port are configured correctly, then we need to check the server's firewall settings. Please make sure the firewall allows the Redis port to pass. If you are using an iptables firewall, you can add the corresponding rules using the following command:

$ sudo iptables -A INPUT -p tcp --dport 6379 -j ACCEPT

If you are using a UFW firewall, you can use the following command to open the corresponding port:

$ sudo ufw allow 6379

After completing the above steps, reconnect to the Redis server and check whether the "Connection refused: no further information" error still occurs.

If the error persists, it may be due to other network configuration issues. You can try to check the network connectivity between the server and the Redis server, for example using the ping command:

$ ping <redis_server_ip>

If there is no response, there may be a network failure and you need to check the network configuration or contact the network administrator to solve the problem.

In summary, the methods to solve the Redis error "Connection refused: no further information" mainly include:

  1. Make sure the Redis service is running, if not, start the Redis service.
  2. Check whether the Redis address and port configuration are correct.
  3. Check the server's firewall settings to ensure that the Redis port can pass the firewall.
  4. Check the network connectivity between the server and the Redis server.

I hope my sharing will be helpful to you.

Guess you like

Origin blog.csdn.net/javamendou/article/details/131570540