Tooling & Monitoring
redis-cli is more than a REPL
Section titled “redis-cli is more than a REPL”redis-cli ships with a rich set of diagnostic flags that go well beyond typing commands. Knowing these tools means you can identify slow queries, memory hogs, and connection problems without any extra software.
INFO — server statistics at a glance
Section titled “INFO — server statistics at a glance”INFO returns a large block of key-value statistics grouped by section. Call a specific section to reduce noise:
127.0.0.1:6379> INFO server# Serverredis_version:7.2.4redis_mode:standaloneos:Linux 5.15.0 x86_64...
127.0.0.1:6379> INFO memory# Memoryused_memory_human:1.02Mused_memory_peak_human:1.03M...
127.0.0.1:6379> INFO stats# Statstotal_commands_processed:1024instantaneous_ops_per_sec:12...INFO server
INFO memory
INFO keyspaceSLOWLOG — find slow commands
Section titled “SLOWLOG — find slow commands”Redis records commands that exceed a configurable threshold (default 10 ms). SLOWLOG GET N returns the N most recent slow entries with timestamp, duration, and full command:
127.0.0.1:6379> SLOWLOG GET 51) 1) (integer) 3 2) (integer) 1700000000 3) (integer) 15420 4) 1) "KEYS" 2) "*" 5) "127.0.0.1:54321" 6) ""Reset the log with SLOWLOG RESET. Adjust the threshold with:
127.0.0.1:6379> CONFIG SET slowlog-log-slower-than 5000OKSLOWLOG GET 5
SLOWLOG LEN
SLOWLOG RESET—bigkeys — find memory-hungry keys
Section titled “—bigkeys — find memory-hungry keys”Run from your shell (not the REPL) to scan the entire keyspace and report the largest key per type:
redis-cli --bigkeysSample output:
-------- summary -------Biggest string found 'session:heavy' has 512000 bytesBiggest list found 'log:events' has 1048576 itemsBiggest hash found 'user:profile:1' has 312 fieldsThis uses SCAN internally so it does not block the server.
—scan and —pattern — iterate the keyspace
Section titled “—scan and —pattern — iterate the keyspace”# List all keys matching a pattern (uses SCAN internally, non-blocking)redis-cli --scan --pattern "session:*"
# Count matching keysredis-cli --scan --pattern "cache:*" | wc -l—latency — measure round-trip time
Section titled “—latency — measure round-trip time”redis-cli --latencyredis-cli --latency-history # sample every 15 secondsredis-cli --latency-dist # ASCII histogramThese ping Redis in a loop and display min/max/avg latency. Use them to detect network jitter or a suddenly slow server.
MONITOR — real-time command stream
Section titled “MONITOR — real-time command stream”MONITOR streams every command processed by the server in real time:
127.0.0.1:6379> MONITOROK1700000001.123456 [0 127.0.0.1:54322] "SET" "foo" "bar"1700000001.124000 [0 127.0.0.1:54322] "GET" "foo"It is invaluable for debugging what an application is actually sending. Press Ctrl+C to stop.
CLIENT LIST — inspect connections
Section titled “CLIENT LIST — inspect connections”CLIENT LIST shows every connected client with its id, address, database, command, and memory usage:
127.0.0.1:6379> CLIENT LISTid=5 addr=127.0.0.1:54321 laddr=127.0.0.1:6379 fd=8 name= age=0 idle=0 flags=N db=0 cmd=client|list ...Kill a stale connection with CLIENT KILL id 5.
CLIENT LIST
CLIENT GETNAME
CLIENT INFORedisInsight — GUI for Redis
Section titled “RedisInsight — GUI for Redis”RedisInsight is the official free GUI from Redis Ltd. It provides a visual keyspace browser, slow-log viewer, memory profiler, and a built-in CLI. Download it from redis.io/insight and point it at any Redis instance — local or remote.