Redis Connection Errors — Server Connection Refused and Memory Limit Issues
Warningdatabase
Overview
Fix Redis connection errors including ECONNREFUSED, OOM command not allowed, max clients reached, and authentication failures on Linux.
Key Details
- Redis defaults to local-only connections on port 6379 with no authentication
- OOM (Out of Memory) errors occur when Redis reaches maxmemory limit
- Redis can be configured for persistence (RDB snapshots, AOF log) or as a pure cache
- Connection limits (maxclients, default 10000) can be exhausted by applications not closing connections
- Redis Sentinel and Cluster add complexity to connection handling
Common Causes
- Redis server not running or listening on a different port/address than expected
- maxmemory limit reached with no eviction policy — Redis rejects write commands
- All client connections used up (maxclients reached)
- Authentication required but client not providing the password (requirepass set)
Steps
- 1Check Redis status: 'systemctl status redis' and 'redis-cli ping' (should return PONG)
- 2For OOM: set eviction policy in redis.conf: 'maxmemory-policy allkeys-lru' to evict least-recently-used keys
- 3Check connections: 'redis-cli info clients' shows connected clients and blocked clients
- 4Configure authentication: set 'requirepass yourpassword' in redis.conf, connect with 'redis-cli -a yourpassword'
- 5Monitor in real-time: 'redis-cli monitor' shows all commands being processed (warning: high overhead in production)
Tags
redisconnectionmemorycachedatabase
Related Items
More in Database
linux-mysql-error-codesLinux MySQL Error Codes — 1045, 2002, 1205 & Common Database Errors
Errorlinux-postgresql-common-errorsPostgreSQL Common Errors — Connection Refused, Authentication, and Query Failures
Warninglinux-mongodb-connection-errorsMongoDB Connection Errors — Authentication Failed and Connection String Issues
WarningFrequently Asked Questions
Redis has reached its maxmemory limit and no eviction policy is set (or all keys have expiry and none can be evicted). Set maxmemory-policy to allkeys-lru to automatically evict old keys when memory is full.