Advance guide for troubleshooting Redis?

Posted by

I’ve put together a list of procedures to follow and sample code to help you troubleshoot Redis when you run into problems.

  1. Check Redis logs:

To view the Redis logs, use the following command:

tail -f /var/log/redis/redis-server.log
  1. Review system logs:

Review system logs, including the syslog or journal, for any error messages, warnings, or critical events.

For example, for the syslog, use the following command:

tail -f /var/log/syslog
  1. Adjust file mode creation mask:

Check the output of umask:

umask
  1. Verify Supervisor process status:

Ensure all processes are in a RUNNING state:

supervisorctl status
  1. Verify DNS configuration:

On the client machine, check if the database endpoint can be resolved using the following command:

dig <endpoint>
  1. Check connectivity using redis-cli:

Test connectivity from the client machine to the database using redis-cli:

redis-cli -h <endpoint> -p <port> -a <password> INFO

If the client machine cannot connect, test connectivity from one of the cluster nodes:

redis-cli -h <node IP or hostname> -p <port> -a <password> PING
  1. Check memory usage:

Run vmstat:

vmstat

Stop any non-Redis related processes if the CPU or RAM consumption exceeds 80%.

  1. Sync host clock with a time server:

Check if time is synchronized with a time server:

ntpq -p
chronyc sources
timedatectl
  1. Manage environment variables:

Run printenv and check if https_proxy and http_proxy are configured as environment variables:

printenv | grep -i proxy
  1. Verify used disk space:

Check the host machine’s disk usage:

df -h
  1. Verify Redis resources:

Run rladmin status issues_only and verify that no issues appear.

For each shard, check the USED_MEMORY:

rladmin status shards

Ensure that the USED_MEMORY is less than 25 GB for each shard.

  1. Check for running tasks:

Run rladmin cluster running_actions and confirm that no tasks are currently running (active).

  1. Benchmark Redis:

Use the redis-benchmark utility to test Redis performance:

redis-benchmark -h <endpoint> -p <port> -a <password>
  1. Handle keys with large memory footprints:

Compare the keys returned by SLOWLOG GET with the output of the following commands:

redis-cli -h <endpoint> -p <port> -a <password> --memkeys
redis-cli -h <endpoint> -p <port> -a <password> --bigkeys
  1. Use alternative commands:

Consider using commands such as SCAN, SSCAN, HSCAN, and ZSCAN.

I hope this guide helps you effectively troubleshoot your Redis issues.Happy coding!

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x