This article is a mirror article of machine translation, please click here to jump to the original article.

View: 22153|Reply: 1

[Redis] SLOWLOG for Redis troubleshooting

[Copy link]
Posted on 6/3/2021 10:47:30 AM | | | |
In the mysql database, slow query logs can be recorded, and for commands that take a long time, they are recorded in the log file, and redis also has slow query logs, which are enabled by default and recorded in memory.
In the server redis logs, it looks like this:

84192:C 02 Jun 2021 05:32:28.074 * RDB: 0 MB of memory used by copy-on-write
11833:S 02 Jun 2021 05:32:28.158 * Background saving terminated with success
11833:S 02 Jun 2021 05:35:28.598 * FAIL message received from a1d5197856bc3da8c376cac9944c1094c47ab113 about b253fafced7217460b528b16d2efbc9059ec89a6
11833:S 02 Jun 2021 05:35:28.599 # Cluster state changed: fail
11833:S 02 Jun 2021 05:35:32.023 # Cluster state changed: ok
11833:S 02 Jun 2021 05:35:35.715 * Clear FAIL state for node b253fafced7217460b528b16d2efbc9059ec89a6: replica is reachable again.
11833:S 02 Jun 2021 05:37:29.073 * 10 changes in 300 seconds. Saving...
11833:S 02 Jun 2021 05:37:29.081 * Background saving started by pid 85398
Found a FAIL message log.


Query slow query logs






Query the current number of slow query log records


Clear the slow query logs



View the configuration

1) "slowlog-log-slower-than"
2) "10000"
3) "slowlog-max-len"
4) "128"
slowlog-log-slower-than represents the threshold for slow queries in microseconds. When the execution time of a query command exceeds the configured threshold, the command is logged to the slow query log. When slowlog-log-slower-than=0, log all commands. slowlog-log-slower-than<0, no commands are logged. The default value for slowlog-log-slower-than is 10000 (10 ms, 1 second = 1,000 ms = 1,000,000 microseconds).

slowlog-max-len represents the maximum number of slow query logs. It is a storage structure in the form of a queue, a first-in, first-out queue, that is, when the maximum number of slow query logs reaches the maximum number, the earliest recorded log entries will be destroyed. The default value of slowlog-max-len is 128 and is stored in memory, so restarting redis will clear the slow query logs.

Modify the configuration

(End)




Previous:.NET/C# verifies that the IP address is within the IP segment
Next:VS Code official download is slow, and domestic mirroring is accelerated
Posted on 9/22/2021 8:28:44 PM |
Learn to learn...
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com