Redis has hit its maximum client connection limit. Increase the maxclients configuration, fix connection leaks in your application, or use connection pooling to resolve this error.
This error occurs when the number of active client connections to your Redis server exceeds the configured maximum limit. Redis has a configurable `maxclients` setting (default 10,000) that prevents too many simultaneous connections to avoid resource exhaustion. When a new client attempts to connect and this limit is reached, Redis refuses the connection and returns this error. The actual limit is also constrained by operating system file descriptor limits.
Connect to Redis and view the current limit:
redis-cli config get maxclientsThis will show your current setting. The default is 10,000.
Increase the limit at runtime using:
redis-cli config set maxclients 50000Replace 50000 with your desired limit. This takes effect immediately but will not persist after Redis restart.
Edit your Redis configuration file (usually /etc/redis/redis.conf) and find the maxclients directive:
maxclients 50000Uncomment or modify the line to your desired value, then save the file.
Redis needs sufficient file descriptors at the OS level. Check and increase the limit:
ulimit -n
ulimit -Sn 100000For permanent changes, edit /etc/systemd/system/redis.service:
[Service]
LimitNOFILE=100000Then reload and restart:
sudo systemctl daemon-reload
sudo systemctl restart redisAfter editing redis.conf, restart the Redis service:
sudo systemctl restart redisOr if using Docker:
docker restart <container_id>Review your application code for missing connection cleanup. Ensure all Redis connections are properly closed:
Node.js/TypeScript:
const redis = require('redis');
const client = redis.createClient();
try {
// Use client
} finally {
await client.quit(); // Explicitly close
}Python:
import redis
client = redis.Redis()
try:
# Use client
finally:
client.close()Go:
client := redis.NewClient(&redis.Options{Addr: "localhost:6379"})
defer client.Close()Use connection pooling to reuse connections instead of creating new ones:
Node.js with redis-pool:
const pool = new Pool({
max: 20,
min: 5,
idleTimeoutMillis: 30000
});Python with redis-py:
from redis import ConnectionPool, Redis
pool = ConnectionPool.from_url('redis://localhost')
client = Redis(connection_pool=pool)Redis 7.0+ includes client eviction, a safety mechanism that automatically disconnects clients consuming the most memory when aggregate client memory exceeds a threshold. You can configure timeout settings to automatically close idle connections: CONFIG SET timeout 300 (300 seconds). For managed Redis services (Heroku, AWS ElastiCache, Google Cloud Memorystore, etc.), the maxclients limit is often determined by your plan tier. Upgrading your plan may be necessary if you consistently need more connections. When calculating required connections, account for application instances, background workers, and monitoring tools. For example, 20 application pods × 50 connections per pod = 1,000 total connections needed.
ERR fsync error
How to fix "ERR fsync error" in Redis
CLUSTERDOWN The cluster is down
How to fix 'CLUSTERDOWN The cluster is down' in Redis
ERR Job for redis-server.service failed because a timeout was exceeded
Job for redis-server.service failed because a timeout was exceeded
ERR Unbalanced XREAD list of streams
How to fix "ERR Unbalanced XREAD list" in Redis
ERR syntax error
How to fix "ERR syntax error" in Redis