E-NO
Redis troubleshooting 7 Min Read

Redis Troubleshooting with Practical Examples: A Field Guide for Developers and DevOps Teams

calendar_today Published: 2026-11-08
update Last Updated: 2026-11-09
analytics SEO Efficiency: 100%
Technical guide illustration for Redis Troubleshooting with Practical Examples: A Field Guide for Developers and DevOps Teams.

Intro

Redis troubleshooting with practical examples should help operators move from an observed problem to a verified result. Start by identifying the installed version, deployment topology, prerequisites, and the exact component being inspected.

This guide addresses Redis troubleshooting for developers, DevOps consultants, and technical startup teams. It connects Redis errors, Redis logs, Redis commands, and Redis recovery to concrete commands, expected outputs, failure signals, and recovery decisions.

The goal is operational safety: observe before changing, limit the blast radius, use placeholders instead of secrets, verify the result, and document how to recover if the expected state is not reached.

Version and Environment Inventory

Before touching anything, inventory the Redis environment: version, deployment topology, OS, and connectivity. This baseline prevents applying wrong-version commands and helps isolate issues.

Identify the Installed Redis Version

Run the Redis CLI command:

redis-cli --version

Example output:

redis-cli 7.2.4

This tells you the CLI version, but the server version may differ. To check the server version, connect and run INFO:

redis-cli INFO server | grep redis_version

Example output:

redis_version:7.2.4

If the CLI and server versions differ, use the server version for command compatibility. Redis 7 introduced significant changes from Redis 6, such as new commands and configuration parameters. Always verify against the server version.

Determine Deployment Topology

Is Redis running standalone, in a cluster, with replication, or under Sentinel? This affects troubleshooting steps.

To check if the instance is a cluster node:

redis-cli CLUSTER INFO

If clustering is not enabled, this returns:

ERR This instance has cluster support disabled

If enabled, it returns cluster state, slots assigned, and known nodes. For a replica check:

redis-cli INFO replication

Look for role:master or role:slave. Example:

role:slave
master_host:192.168.1.100
master_port:6379
master_link_status:up

If master_link_status:down, replication is broken and needs immediate attention.

Check Prerequisites

Redis runs on Linux, macOS, and Windows (via WSL or unofficial ports). Ensure the OS is supported and resources meet requirements. Typical minimal setup: 1 GB RAM, but for production allocate at least 4 GB and consider maxmemory.

Read-Only Observation Commands

Before making changes, capture current state:

redis-cli INFO

This returns many sections. Focus on memory, stats, clients, persistence. Save output to a file with timestamp for later comparison:

redis-cli INFO > redis_info_$(date +%Y%m%d_%H%M%S).txt

Also capture configuration:

redis-cli CONFIG GET '*'

This lists all current settings. Protect this file if it contains sensitive values (e.g., requirepass). Do not print secrets to screenshots or logs.

Defining Expected Results and Failure Signals

For every diagnostic, define what normal looks like. For example, expected redis-cli PING response is PONG. If it returns NOAUTH Authentication required, authentication is misconfigured or missing. Document these before intervention.

Safe Change Principles

  • Change one item at a time.
  • Understand blast radius: e.g., changing maxmemory may evict keys; changing appendonly affects persistence.
  • Have a recovery path: e.g., if a config change causes failure, revert via CONFIG SET or restart with original config.

Safe Configuration Path

Configuration issues are common sources of Redis problems. Follow a methodical path to avoid making things worse.

Capturing Current Configuration

Always capture the current runtime configuration before changes:

redis-cli CONFIG GET parameter_name

For example, to check maxmemory:

redis-cli CONFIG GET maxmemory

Output:

1) "maxmemory"
2) "0"

0 means no memory limit, which can lead to OOM kills. To set a new value, first know the expected memory usage. Suppose you want to limit to 4 GB:

redis-cli CONFIG SET maxmemory 4gb

Verify:

redis-cli CONFIG GET maxmemory

Output:

1) "maxmemory"
2) "4294967296"

Note: bytes are returned. To make persistent, also update redis.conf (or use CONFIG REWRITE if supported).

Changing a Configuration Safely

When changing multiple settings, do them one by one or use a transaction? Redis CONFIG SET is atomic per command. For batch changes, use CONFIG SET multiple times, verifying after each.

Use CONFIG REWRITE to persist runtime changes to the config file (available in Redis 2.8+). Ensure the config file is writable by the Redis process. Example:

redis-cli CONFIG REWRITE

Output:

OK

If it fails, check permissions and disk space. Never edit redis.conf directly while Redis is running unless you know what you are doing; changes won't take effect until restart.

Recovering from Bad Config Changes

If a change causes issues, revert immediately. For runtime changes, set back the old value:

redis-cli CONFIG SET maxmemory 0

If Redis is unresponsive, restart with the previous config file. Have a backup of the original config file before editing.

Verification and Diagnostics

Systematic diagnostics pinpoint root causes. Use built-in commands to gather evidence.

Memory Diagnostics

High memory usage is a top issue. Use INFO memory:

redis-cli INFO memory

Key metrics:

  • used_memory: total bytes allocated by Redis.
  • used_memory_rss: memory used by the OS process, includes fragmentation.
  • mem_fragmentation_ratio: RSS / used_memory. Ratio > 1.5 indicates fragmentation; > 2 severe.
  • maxmemory: configured limit (0 if none).
  • maxmemory_policy: eviction policy.

Example output snippet:

used_memory:1234567
used_memory_rss:2000000
mem_fragmentation_ratio:1.62
maxmemory:0
maxmemory_policy:noeviction

If mem_fragmentation_ratio is high, consider enabling activedefrag (Redis 4.0+):

redis-cli CONFIG SET activedefrag yes

Verify:

redis-cli CONFIG GET activedefrag

Output:

1) "activedefrag"
2) "yes"

Monitor defrag stats with INFO stats.

Latency Diagnostics

Use redis-cli --latency to measure server response time:

redis-cli --latency -h 127.0.0.1 -p 6379

Sample output:

min: 0, max: 2, avg: 0.28 (1248 samples)

High latency may be caused by slow commands. Use SLOWLOG:

redis-cli SLOWLOG GET 10

Each entry includes an ID, timestamp, execution time in microseconds, and command arguments. Example:

1) 1) (integer) 12345
   2) (integer) 1678901234
   3) (integer) 150000
   4) 1) "KEYS"
      2) "*"

KEYS * is notorious for blocking. Avoid in production; use SCAN instead.

To see current slow operations in real time, use MONITOR (but note it reduces throughput):

redis-cli MONITOR

Press Ctrl+C to stop. Never run MONITOR on production for long periods.

Client Connection Diagnostics

Check connected clients:

redis-cli CLIENT LIST

Look for many connections from one host, high idle times, or blocked clients. For example, if you see omem=0 and cmd=client with long age, clients may be stuck.

Get count:

redis-cli INFO clients

Key items: connected_clients, blocked_clients. If blocked_clients > 0, investigate blocking commands like BLPOP.

Persistence Diagnostics

Check RDB and AOF status:

redis-cli INFO persistence

Important fields:

  • rdb_last_bgsave_status: should be ok.
  • rdb_last_bgsave_time_sec: duration of last snapshot.
  • aof_enabled: 0 or 1.
  • aof_last_write_status: should be ok.
  • aof_last_bgrewrite_status: should be ok.

If rdb_last_bgsave_status:err, check disk space and permissions. If aof_last_write_status:err, disk full or write issues.

Replication Diagnostics

Already touched; use INFO replication to verify master/replica sync:

redis-cli INFO replication

Look for master_link_status:up. If down, check master_link_down_since_seconds to see how long.

Failure Modes and Recovery

Common Redis failure modes and how to recover from each.

Out of Memory (OOM)

Symptom: writes fail with OOM command not allowed when used memory > 'maxmemory'.

Cause: maxmemory exceeded and eviction policy is noeviction.

Recovery:

  1. Check current memory:
   redis-cli INFO memory | grep used_memory_human
  1. Check policy:
   redis-cli CONFIG GET maxmemory-policy
  1. If noeviction, consider setting a policy like allkeys-lru (be careful: evicts keys):
   redis-cli CONFIG SET maxmemory-policy allkeys-lru
  1. Alternatively, increase maxmemory if system has free memory:
   redis-cli CONFIG SET maxmemory 8gb
  1. Verify writes succeed.

Replication Broken

Symptom: master_link_status:down in replica.

Cause: network partition, master restart, wrong replicaof config.

Recovery:

  1. Check network connectivity from replica to master: ping master_ip, telnet master_ip 6379.
  2. Verify replicaof configuration:
   redis-cli CONFIG GET replicaof

(or slaveof for older versions).

  1. Restart replication manually:
   redis-cli REPLICAOF master_ip master_port

Replace with actual IP and port.

  1. Check INFO replication again; expect master_link_status:up and master_sync_in_progress:0 eventually.

Slow Queries Blocking

Symptom: high latency, clients timing out.

Cause: expensive commands like KEYS, SMEMBERS on large sets, SORT on large lists.

Recovery:

  1. Identify via SLOWLOG GET 50.
  2. Rewrite application to avoid blocking commands. Use SCAN instead of KEYS.
  3. Consider using Redis Cluster to distribute load.
  4. Set timeout to disconnect idle clients:
   redis-cli CONFIG SET timeout 300

Disk Full or Persistence Failure

Symptom: MISCONF Redis is configured to save RDB snapshots, but it is currently unable to persist on disk.

Cause: no disk space, permissions, or RDB save settings misconfigured.

Recovery:

  1. Check disk space: df -h.
  2. Check Redis log for errors.
  3. Free space or change RDB directory permissions.
  4. Temporarily disable RDB saves (not recommended, but to restore functionality):
   redis-cli CONFIG SET save ""
  1. Address root cause then re-enable saves.

Authentication Issues

Symptom: NOAUTH Authentication required.

Cause: requirepass set but client not providing password, or wrong password.

Recovery:

  1. Provide correct password: redis-cli -a 'your_strong_password' (but careful: password exposed in process list).
  2. Better: use REDISCLI_AUTH environment variable.
  3. To disable password (if safe), set requirepass "" via CONFIG SET and update config.

Operations Checklist

A practical checklist for Redis operations teams to run before, during, and after incidents.

Pre-Incident Preparation

  • [ ] Document Redis version, topology, and config file location.
  • [ ] Set up monitoring for key metrics: memory usage, hit ratio, connected clients, latency, persistence status. Use Redis exporter for Prometheus.
  • [ ] Test backups: regularly restore from RDB/AOF to a staging instance.
  • [ ] Define alert thresholds: e.g., memory used >80% of maxmemory, replication lag >60 seconds, error rate >1%.
  • [ ] Prepare runbooks for common scenarios.

During Incident

  • [ ] Capture current state before changes: redis-cli INFO > /tmp/redis_before_$(date +%s).txt.
  • [ ] Check the basics: PING, INFO server version, CLIENT LIST, SLOWLOG.
  • [ ] Identify the failing component: client, network, server, or persistence.
  • [ ] Make one change at a time; record each change with timestamp and outcome.
  • [ ] Use safe commands: prefer CONFIG GET before SET, avoid FLUSHALL or KEYS *.
  • [ ] Communicate with stakeholders.

Post-Incident

  • [ ] Compare before/after INFO outputs.
  • [ ] Document root cause and action items.
  • [ ] Update runbooks and monitoring if needed.
  • [ ] Schedule review of any security changes (e.g., password changes) with the security owner.

Accountability and Review Cadence

Assign a single owner for Redis operations decisions, such as the DevOps Lead (e.g., Jordan Lee, DevOps Lead). The owner is accountable for configuration changes, incident response, and quarterly reviews of capacity, security, and performance.

Common Pitfalls and How to Avoid Them

Avoid these mistakes that often worsen Redis problems.

Running KEYS * in Production

Why it happens: developers use it for debugging or cache clearing. Impact: blocks the server, causing latency spikes and timeouts. How to avoid: use SCAN with cursor, or use redis-cli --scan for non-blocking iteration. Example:

redis-cli --scan --pattern 'user:*'

Ignoring Memory Fragmentation

Why it happens: not monitored; used_memory seems low but RSS is high. Impact: OOM killer may terminate Redis despite low logical memory. How to avoid: monitor mem_fragmentation_ratio. If >1.5, enable activedefrag. Ensure activedefrag is supported (Redis 4.0+).

Not Setting maxmemory or Using noeviction

Why it happens: default config has maxmemory 0; developers assume unlimited. Impact: Redis may consume all system memory and get killed; or writes fail if policy is noeviction. How to avoid: set appropriate maxmemory and choose an eviction policy such as allkeys-lru for cache use cases. Test eviction behavior.

Using Default or Weak Passwords

Why it happens: convenience; no authentication configured. Impact: data exposure, unauthorized access, especially if exposed to internet. How to avoid: set a strong requirepass, use TLS, restrict network access with firewall or bind to localhost if possible. Rotate passwords regularly.

Editing redis.conf While Redis is Running Without CONFIG REWRITE

Why it happens: operators edit file and restart later, losing runtime changes or causing inconsistency. Impact: configuration mismatch, unexpected behavior after restart. How to avoid: use CONFIG SET for runtime changes and CONFIG REWRITE to persist. If manually editing file, do so when Redis is stopped or thoroughly test after restart.

Running MONITOR Indefinitely

Why it happens: debugging commands; operator forgets to stop. Impact: reduces throughput by ~50%. How to avoid: use MONITOR for short periods only, or prefer SLOWLOG and client-side tracing.

Conclusion

Redis troubleshooting with practical examples is useful only when each recommendation is version-scoped, observable, and reversible where the technology permits. Copying a command without checking prerequisites and expected output is not an operations procedure.

As a next step, choose one low-risk verification for Redis troubleshooting, record the current state, run the documented check, compare the result with the expected signal, and review dependencies such as Node.js, Docker, and monitoring.

A reliable technical workflow makes failure visible, protects sensitive values, limits changes to the intended resource, and defines recovery verification before an incident forces the decision.

For ongoing improvement, schedule a quarterly review with the Redis operations owner to revisit capacity, performance, and security settings. Keep runbooks updated and practice recovery procedures regularly to ensure your team is ready for the next incident.

Related Research

Article Quality Score

Reader usefulness 100%
  • check_circle Reader-ready guide
  • check_circle Practical examples included
  • check_circle Clean SEO article URL