redis://localhost:6379 — Connect & Run Redis Locally
What does redis://localhost:6379 mean? URI formats, redis-cli, Docker, and Connection refused fixes.
redis://localhost:6379, redis localhost, or REDIS_URL=redis://localhost:6379 means your app expects Redis on this machine (default port 6379). It is a connection string, not a browser URL.
Connection string cheat sheet
| Use | URI / config |
|---|---|
| Default (no password) | redis://localhost:6379 |
| DB index | redis://localhost:6379/0 |
| With password | redis://:password@localhost:6379/0 |
| Env var | REDIS_URL=redis://localhost:6379 |
Also: redis_url=redis://localhost:6379. Port guide: localhost ports §6379.
Verify with a client
redis-cli -u redis://localhost:6379 ping
# PONG
redis-cli
SET user:1 "Alice"
GET user:1const Redis = require('ioredis');
const redis = new Redis(process.env.REDIS_URL || 'redis://localhost:6379');Typical uses: API cache, sessions, Bull/BullMQ queues, rate limiting.
Install & start
macOS: brew install redis → brew services start redis
Docker:
docker run -d --name redis -p 6379:6379 redis:7Compose: map 6379:6379, set REDIS_URL=redis://localhost:6379 on the host (use hostname redis between containers).
Troubleshooting
ECONNREFUSED 127.0.0.1:6379 — start Redis; check lsof -i :6379.NOAUTH — include password in the URI.
Port busy — map 6380:6379 and update the URI.
Do not expose passwordless Redis on 0.0.0.0 to the public internet.
See port-conflicts, MongoDB.
Summary
redis://localhost:6379 = local Redis default. Confirm with redis-cli ping, then set REDIS_URL.