redis
32 commands
32 shown
Connect to Redis CLI
Open interactive Redis CLI session
redis-cli -h redis -p 6379 -a <password>
Redis info all
Full server information: memory, CPU, clients, persistence
redis-cli -h redis INFO all
Monitor commands in real-time
Stream all commands executed on the Redis server
redis-cli -h redis MONITOR
Slow log
Show last 20 slow queries with execution time
redis-cli -h redis SLOWLOG GET 20
Memory usage of key
Show bytes consumed by a specific key
redis-cli -h redis MEMORY USAGE <key>
Flush database
Delete all keys in current DB asynchronously
redis-cli -h redis FLUSHDB ASYNC
Save snapshot (BGSAVE)
Trigger background RDB snapshot save
redis-cli -h redis BGSAVE
Check replication info
Show master/replica role, replication offset, connected replicas
redis-cli -h redis INFO replication
Scan keys by pattern
Non-blocking key scan by pattern (prefer over KEYS in production)
redis-cli -h redis --scan --pattern 'session:*' | head -20
TTL of a key
Remaining TTL in seconds; -1 = no expiry, -2 = not found
redis-cli -h redis TTL <key>
Monitor real-time commands
Stream every command sent to Redis (exclude health pings)
redis-cli MONITOR | grep -v PING
Show slow query log
Last 20 slow commands with execution time in microseconds
redis-cli SLOWLOG GET 20
Memory usage per key pattern
Total memory consumed by keys matching a pattern
redis-cli --scan --pattern 'session:*' | xargs -n1 redis-cli MEMORY USAGE | awk '{sum+=$1} END{print sum/1024/1024" MB"}'
Delete keys by pattern
Safely scan-delete matching keys without KEYS command
redis-cli --scan --pattern 'cache:*' | xargs -r redis-cli DEL
Set key with TTL
Set key with 1-hour expiry (EX = seconds)
redis-cli SET mykey 'value' EX 3600
Increment counter
Atomically increment an integer counter
redis-cli INCRBY counter:hits 1
Pub/Sub publish
Publish a message to a Redis pub/sub channel
redis-cli PUBLISH events '{"type":"login","user":"alice"}'
Subscribe to channel
Subscribe and listen to messages on a channel
redis-cli SUBSCRIBE events
Show replication info
Role, connected replicas, replication lag
redis-cli INFO replication
Force save to disk (BGSAVE)
Trigger background RDB save and check its timestamp
redis-cli BGSAVE && redis-cli LASTSAVE
Flush single database
Asynchronously flush database index 1 only
redis-cli -n 1 FLUSHDB ASYNC
Sorted set top-N
Top 10 entries from a sorted set with scores
redis-cli ZREVRANGEBYSCORE leaderboard +inf -inf WITHSCORES LIMIT 0 10
Stream add message
Append a message to a Redis Stream with auto-ID
redis-cli XADD mystream '*' event login user alice
Cluster info
Cluster health and node list with slot ranges
redis-cli -c CLUSTER INFO && redis-cli -c CLUSTER NODES
Benchmark throughput
100k requests, 50 clients, 10 pipeline depth (quiet output)
redis-benchmark -q -n 100000 -c 50 -P 10
Find biggest keys
Sample keyspace to find largest keys per type; note: estimates, runs SCAN not blocking
redis-cli --bigkeys
Top memory keys
Sample keys ranked by actual memory usage, not element count; finds RAM hogs
redis-cli --memkeys
Exact key memory
Bytes used by a single key incl overhead; SAMPLES 0 = exact for collections
redis-cli MEMORY USAGE <name> SAMPLES 0
Slowlog inspection
List 10 slowest commands with args and duration, then clear the log
redis-cli SLOWLOG GET 10; redis-cli SLOWLOG RESET
Latency root-cause advice
Human-readable latency analysis with likely causes; pair with LATENCY HISTORY <event>
redis-cli LATENCY DOCTOR
Oldest idle clients
Find long-lived/idle connections leaking sockets; sort by age then idle
redis-cli CLIENT LIST | tr ' ' '\n' | grep -E 'addr=|age=|idle=' | paste - - - | sort -t= -k3 -rn | head
Cluster health check
Verify slot coverage, node consistency and open slots across the cluster
redis-cli --cluster check <host>:<port>
no commands match