Effective monitoring is crucial for maintaining healthy Redis deployments. This guide covers essential metrics, tools, and best practices for Redis observability.
used_memory: Total bytes allocated by Redis using its allocatorused_memory_rss: Bytes that Redis allocated as seen by the OSmem_fragmentation_ratio: Ratio of RSS to used_memory (should be < 1.5)maxmemory: Maximum memory Redis is configured to usemaxmemory_policy: Current eviction policy in effectinstantaneous_ops_per_sec: Operations per secondtotal_commands_processed: Total number of commands processedkeyspace_hits: Number of successful lookup of keys in the main dictionarykeyspace_misses: Number of failed lookup of keys in the main dictionaryhit_rate: Calculated as keyspace_hits / (keyspace_hits + keyspace_misses)rdb_last_bgsave_status: Status of the last RDB save operationaof_last_bgrewrite_status: Status of the last AOF rewrite operationaof_current_size: Current AOF file sizeaof_base_size: AOF file size on latest startupmaster_repl_offset: Master replication offsetslave_repl_offset: Slave replication offset (on replica nodes)connected_slaves: Number of connected slavesmaster_link_status: Up/down status of master-slave linklatency_percentiles: Latency distribution percentileshot_keys: Information about hot keys detected by the HOTKEYS commandredis-cli ping
redis-cli info
redis-cli info memory
redis-cli info stats
redis-cli info persistence
redis-cli info replication
redis-cli monitor
redis-cli slowlog get 10
redis-cli slowlog len
redis-cli slowlog reset
Example Prometheus configuration:
- job_name: 'redis'
static_configs:
- targets: ['localhost:9121']
redis-cli --stat: Shows real-time statisticsredis-cli --bigkeys: Scan for big keysredis-cli --hotkeys: Show hot keys (Redis 8.6+)debug: Verbose information for debuggingverbose: Many rarely useful messagesnotice: Moderately verbose (recommended for production)warning: Only very important / critical messagesConfigure log rotation to prevent disk space issues:
# In redis.conf
logfile /var/log/redis/redis-server.log
High mem_fragmentation_ratio (> 1.5) indicates memory fragmentation:
redis-cli info memory | grep mem_fragmentation_ratio
Monitor for active key evictions:
redis-cli info stats | grep expired_keys
redis-cli info stats | grep evicted_keys
Check for slow persistence operations:
redis-cli info persistence | grep rdb_last_bgsave_time_sec
redis-cli info persistence | grep aof_last_rewrite_time_sec
Use the new HOTKEYS command to identify heavily accessed keys:
redis-cli HOTKEYS
Monitor for failed authentication attempts:
redis-cli info server | grep rejected_connections
Watch for unexpected client connections or command patterns.
INFO memory for usage breakdown--bigkeys to find large keysSLOWLOG for slow queriesINFO replication on master and slave