Port 6379
Redis In-Memory Data Store
Port 6379: Redis
| Protocol | TCP |
| Service | Redis |
| Encrypted | Optional (TLS) |
| IANA Status | Official |
What is Port 6379?
Port 6379 is the default port for Redis, an open-source in-memory data structure store. Redis is commonly used for caching, session storage, message queuing, and real-time analytics.
Connection Examples
# redis-cli
redis-cli -h localhost -p 6379
redis-cli -h localhost -p 6379 -a password
# Connection URL
redis://localhost:6379
redis://:password@localhost:6379/0
rediss://localhost:6379 # TLS
# Node.js (ioredis)
const Redis = require('ioredis');
const redis = new Redis({
host: 'localhost',
port: 6379,
password: 'secret'
});
# Python
import redis
r = redis.Redis(host='localhost', port=6379, password='secret')
Security Configuration
Redis has no authentication by default
Always set a password and bind to localhost or use firewall rules.
# /etc/redis/redis.conf
# Bind to localhost only (safe default)
bind 127.0.0.1 ::1
# Set a strong password
requirepass your_strong_password_here
# Disable dangerous commands
rename-command FLUSHDB ""
rename-command FLUSHALL ""
rename-command DEBUG ""
rename-command CONFIG ""
# Restart Redis
sudo systemctl restart redis
Common Use Cases
- Caching: Store frequently accessed data in memory
- Session storage: Store user sessions for web apps
- Rate limiting: Track request counts with TTL
- Message queue: Pub/Sub for real-time messaging
- Leaderboards: Sorted sets for rankings
Basic Commands
# Test connection
redis-cli ping
# Response: PONG
# Set and get values
SET mykey "Hello"
GET mykey
# Set with expiration (seconds)
SETEX session:123 3600 "user_data"
# Check TTL
TTL session:123
# List all keys (use carefully in production)
KEYS *
# Get server info
INFO
Troubleshooting
# Check if Redis is running
sudo systemctl status redis
sudo ss -tlnp | grep 6379
# Test connection
redis-cli ping
redis-cli -a password ping
# Check what Redis is bound to
redis-cli CONFIG GET bind
# Monitor commands in real-time
redis-cli monitor
# Check memory usage
redis-cli INFO memory
Common Issues
- NOAUTH: Authentication required - provide password
- Connection refused: Redis not running or wrong bind address
- OOM: Out of memory - increase maxmemory or eviction policy
- Slow operations: Check for blocking commands with SLOWLOG