Back to error codes
ERROR ECONNREFUSED
Redis Connection Error
Database Error
The application cannot connect to the Redis server.
Root Cause
Redis is not running, is on a different host/port, or a firewall is blocking the connection.
How to Fix
Start Redis: redis-server. Verify the host and port in your connection configuration. Check firewall rules.
Quick Summary
Redis connection refused. Verify Redis is running (redis-cli ping), check the host/port configuration, and ensure no firewall is blocking port 6379.
Key Takeaways
Key Takeaways
- Default Redis port is 6379
- Check if Redis is running: redis-cli ping (should return PONG)
- Verify connection string: redis://localhost:6379
- In Docker, use the service name as the host: redis://redis:6379
Use Cases
When to use it
- Redis not started
- Wrong host in connection string
- Redis in Docker not accessible from the app container
Watch out
Common Mistakes
- Using localhost when Redis is in a Docker container, use the container/service name instead
- Not implementing reconnection logic, Redis connections can drop and need to be re-established
FAQ
ECONNREFUSED Redis Connection Error, Frequently Asked
How do I check if Redis is running?
redis-cli ping, returns PONG if Redis is running. Or: systemctl status redis (Linux).
Still having issues?
Check your network logs or use our developer tools to inspect headers, decode tokens, or validate your requests.