redis COMMAND command in the slowlog

166 views
Skip to first unread message

Peng Yang

unread,
Sep 18, 2018, 5:48:51 AM9/18/18
to Redis DB

I use the redis sentinel,I set the slowlog-log-slower-than 1000,but I find many COMMAND in the slowlog ,I use redis monitor find this command from 127.0.0.1,i dont konw which process execute this,why

,捕获.PNG

redis.PNG


hva...@gmail.com

unread,
Sep 18, 2018, 7:10:05 AM9/18/18
to Redis DB
Hello Peng Yang,

Here is the explanation from the sample redis.conf file for slowlog-log-slower-than:

# The following time is expressed in microseconds, so 1000000 is equivalent
# to one second. Note that a negative number disables the slow log, while
# a value of zero forces the logging of every command.
slowlog-log-slower-than 10000

The example given in the config file is 10,000 which is 10 milliseconds.  Your Redis is configured with 1,000 which is 1 millisecond, and you have noticed that now your slowlog file is "noisy".  In other words, many commands appear in the log.

The Redis command 'COMMAND' is described in the documentation (https://redis.io/commands/command), and it displays the status of all commands in Redis's command set.  One of the things it reveals about each command is whether or not the command is enabled on that server.  Some commands are disabled on slaves.

So what process might be running on the same machine (connecting via localhost) that would be interested in whether the Redis server is properly configured as a master or as a slave?
  • Monitoring - If you have configured your monitoring system to check Redis's health, it may connect from the monitoring agent on the same machine and will issue commands to Redis.  Perhaps one of them is COMMAND.
  • Sentinel - You mentioned that you're using Sentinel, but didn't describe whether the Sentinel processes are running on different machines or on the same machines.  Sentinel configures each Redis server process that it monitors, and it's reasonable that Sentinel would read the configuration of the Redis server, to learn which commands are enable or disabled, and perhaps change the configuration.
  • Client - many ordinary client libraries probe the Redis server processes to learn its capabilities.  It's possible a Redis client library/module is doing this.
It's unusual to run client programs on the same machine as Redis.  It is more common to run Sentinel or monitoring on the same machine, so I believe the 'COMMAND' commands are coming from Sentinel or from your own monitoring system.

I think setting slowlog-log-slower-than to a value this low is going to bring you more confusion than useful knowledge, so I suggest a higher value.
Reply all
Reply to author
Forward
0 new messages