Skip to content

Cache Connection Failed

Error message

                Error: Redis connection refused
              

Quick summary

The cache server is unreachable, causing the application to fall back to slower data sources or fail entirely.

Why this happens

  • The cache server (Redis, Memcached) is not running

  • Network issues prevent the application from reaching the cache

  • Cache credentials or connection string are incorrect

  • The cache server is overloaded and rejecting connections

Minimal example

✗ Broken code
# App tries to connect to Redis
REDIS_URL=redis://redis:6379
# Error: connection refused — Redis is down
✓ Fixed code
# Restart Redis
kubectl rollout restart deployment/redis
# Wait for it to be ready
kubectl wait --for=condition=ready pod -l app=redis --timeout=60s

Redis is down. The fix restarts the Redis deployment and waits for it to be ready.

How to diagnose

  • Check if the cache is running: kubectl get pods -l app=redis

  • Test connectivity: redis-cli -h <host> -p <port> ping

  • Verify the cache URL and credentials in configuration

  • Check cache server logs for errors or connection limits

How to fix

  • Start or restart the cache server

  • Fix network connectivity to the cache

  • Correct the cache connection string and credentials

  • Increase cache server resources or max connections

How to prevent

  • Implement graceful degradation when the cache is unavailable

  • Monitor cache health and alert on connection failures

  • Use connection pooling for cache connections

Related Resources

Related Glossary

← Back to language