Redis: Could not connect to Redis at 127.0.0.1:6379: Connection refused
Redis: Could not connect to Redis at 127.0.0.1:6379: Connection refused
DodaTech
2 min read
The error “Could not connect to Redis at 127.0.0.1:6379: Connection refused” means the Redis client could not establish a TCP connection to the Redis server on the default port.
What It Means
The redis-cli (or your application’s Redis client) attempted to connect to 127.0.0.1 on port 6379. The operating system returned “Connection refused” because no process is listening on that address and port combination.
Why It Happens
- The Redis server (
redis-server) is not running. - The Redis service failed to start due to a configuration error or port conflict.
- Redis is configured to listen on a Unix socket only (no TCP port).
- Redis is bound to a specific IP (e.g.,
192.168.1.100) but you connected to127.0.0.1. - A firewall is blocking port 6379 on the loopback interface.
- Redis is running inside a container without the port mapped to the host.
How to Fix It
1. Start the Redis server
sudo systemctl start redis-server
sudo systemctl enable redis-server2. Verify Redis is listening
sudo ss -tlnp | grep 6379Expected output shows redis-server listening on 127.0.0.1:6379.
3. Test the connection
redis-cli pingExpected response: PONG.
4. Check the Redis configuration
sudo grep -E '^bind |^port ' /etc/redis/redis.conf5. Start Redis manually for debugging
redis-server --daemonize yes6. Check Redis logs
sudo journalctl -u redis-server --no-pager -n 50FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro