database
connection_error
ai_generated
true
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
ID: database/redis-connection-refused
93%Fix Rate
95%Confidence
72Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7 | active | — | — | — |
Root Cause
Redis server is not running or not listening on the expected host/port. Commonly caused by the redis-server process not being started, bind address misconfiguration, or protected-mode blocking connections from non-loopback addresses.
genericWorkarounds
-
94% success Start the Redis server and verify it is listening
Run: sudo systemctl start redis-server (or redis). Verify: redis-cli ping (should respond PONG). Check binding: redis-cli CONFIG GET bind. If connecting remotely, ensure redis.conf has 'bind 0.0.0.0' or the specific interface IP, and 'protected-mode no' (or set a password).
-
88% success Check and fix protected-mode and firewall rules
Redis 7 enables protected-mode by default, which rejects non-loopback connections when no password is set. Either set a password in redis.conf: requirepass yourpassword, or bind to specific IPs. Check firewall: sudo ufw allow 6379.
Dead Ends
Common approaches that don't work:
-
Changing Redis client library configuration (timeouts, retry settings) when the server is not running
95% fail
Client-side configuration changes cannot make a connection to a server that is not listening. The error is at the TCP level; no amount of client tuning can establish a connection to a closed port.
-
Reinstalling Redis client packages to fix connection refused
95% fail
The client library correctly reports that the server is unreachable. The issue is server-side; reinstalling the client package has no effect on server availability.
Error Chain
Leads to:
Preceded by:
Frequently confused with: