Redis is typically used to improve the performance of web applications and other high-speed requirements because it stores data like cache and NoSQL databases in RAM, which provides very fast data access.
But what if you get a Redis is unreachable error message when trying to use this feature?
Here we will discuss the steps you can take to resolve this Redis is unreachable issue.
How to Fix Redis is unreachable
Some of these steps may require configuration and checks on the server side. If you are using shared hosting, you can ask your hosting provider directly.
1. Ensure the PHP Redis Extension is Active
If you are using Redis for a website like WordPress, you need to ensure that the Redis extension is active.
For example, if you are using cPanel, you can enable the Redis extension from the Select PHP Version > Extensions
2. Check the Redis Port
The first thing you can do is check and ensure that the Redis port is open, for example by using netstat
sudo netstat -lntu | grep 6379By default, Redis uses port 6379, but if this port is closed, you need to check the firewall configuration on the server and open that port, for example with UFW
sudo ufw allow 6379/tcpsudo ufw reloadAlternatively, you can use firewall-cmd
sudo firewall-cmd --zone=public --add-port=6379/tcp --permanentsudo firewall-cmd --reload3. Ensure Redis is Installed and Active
If the port is open but you still cannot connect, ensure that Redis is installed and active on the server you are using
sudo systemctl status redisIf the Redis status is not found, you can install Redis first, for example on Ubuntu
sudo apt install redis-serversudo apt install php-redisHowever, if it is already installed but the status is stopped, you can start Redis and enable it so it automatically starts when the system reboots
sudo systemctl start redissudo systemctl enable redis4. Check the Redis Configuration File
Ensure the Redis configuration file is still saved on the server, which is usually stored in /etc/redis/redis.conf. If you cannot find this file, you can copy the default configuration file from the Redis page according to the version of Redis you are using.
5. Check the Redis Logs
If you have tried everything and it is still showing an error, you can check the Redis logs for more information on the cause of the error
sudo tail /var/log/redis/redis-server.log -n 1006. Restart Redis
Usually, you only need to restart the service when there is an error, and you can try this method as well
sudo systemctl restart redisThose are some ways you can resolve the Redis is unreachable error. Since this error usually requires you to check directly from the server as mentioned at the beginning, if you are using shared hosting that does not have direct server access, you can ask your hosting provider.
COMMENTS
Loading...