Using homebrew to install Redis but when I try to ping Redis it shows this error:
Could not connect to Redis at 127.0.0.1:6379: Connection refused
I was stuck on this for a long time. After a lot of tries I was able to configured it properly.
There can be different reasons of raising the error. I am trying to provide the reason and the solution to overcome from that situation.
6379 Port is not allowed by ufw firewall.
Solution: type following command sudo ufw allow 6379
The issue can be related to permission of redis user. May be redis user doesn't have permission of modifying necessary redis directories. The redis user should have permissions in the following directories:
/var/lib/redis/var/log/redis/run/redis/etc/redisTo give the owner permission to redis user, type the following commands:
sudo chown -R redis:redis /var/lib/redissudo chown -R redis:redis /var/log/redissudo chown -R redis:redis /run/redissudo chown -R redis:redis /etc/redis.Now restart redis-server by following command:
sudo systemctl restart redis-server
Hope this will be helpful for somebody.