Skip to content
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 to 127.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-server

2. Verify Redis is listening

sudo ss -tlnp | grep 6379

Expected output shows redis-server listening on 127.0.0.1:6379.

3. Test the connection

redis-cli ping

Expected response: PONG.

4. Check the Redis configuration

sudo grep -E '^bind |^port ' /etc/redis/redis.conf

5. Start Redis manually for debugging

redis-server --daemonize yes

6. Check Redis logs

sudo journalctl -u redis-server --no-pager -n 50

FAQ

What is the default Redis port?
The default port is 6379. You can change it with the port directive in /etc/redis/redis.conf or by passing --port 6380 when starting redis-server.
How do I allow remote connections to Redis?
Change bind 127.0.0.1 to bind 0.0.0.0 in redis.conf and set protected-mode no. Be aware this exposes Redis to the network — use a firewall or Redis ACLs to restrict access.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro