localhost:6379
Port 6379 is Redis — the blazing fast in-memory data store. Used for caching, session storage, message queues, and real-time analytics. If your app needs speed, Redis on 6379 is likely involved.
Connect to Redis
Redis CLI
# Connect
redis-cli
# Or specify host/port
redis-cli -h localhost -p 6379
# Test connection
127.0.0.1:6379> PING
PONG
# Set and get
127.0.0.1:6379> SET mykey "Hello"
OK
127.0.0.1:6379> GET mykey
"Hello"
Connection Strings
# Standard format
redis://localhost:6379
# Node.js (ioredis)
const Redis = require('ioredis');
const redis = new Redis(6379, 'localhost');
# Python
import redis
r = redis.Redis(host='localhost', port=6379, db=0)
# PHP
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
Check if Redis is Running
# Linux
sudo systemctl status redis
# Mac (Homebrew)
brew services list | grep redis
# Docker
docker ps | grep redis
# Test connection
redis-cli ping
Common Errors
| Error | Solution |
|---|---|
| Connection refused | Redis not running. Start the service. |
| NOAUTH required | Redis has password. Use AUTH command. |
| OOM (out of memory) | Set maxmemory in redis.conf |
Start Redis
# Linux
sudo systemctl start redis
# Mac
brew services start redis
# Docker
docker run -d -p 6379:6379 redis
# Manual
redis-server