Search code examples
redisredis-sentinel

Redis Sentinel - How to get Config Value?


I want to find the number of maxclients for a running Redis sentinel. There is no config set in the .conf file for the sentinel, so I want to find out the current value.

However when I connect via redis-cli -p 26379 and enter "config get maxclients", it tells me there's no such command. However, it works if I connect to the actual Redis instance.

How do I get the maxclients value for a redis sentinel ?


Solution

  • There is currently no way to do this, since Sentinel does not export a CONFIG command. However if you reach the connection limit, Sentinel will be able to reply with an error about the limit reached, so you can kinda understand if the limit was reached in this way. Of course in the case of Sentinel you can set a maxclients value in sentinel.conf and restart the system. Restarting a single Sentinel will not cause any availability concern since there are the other Sentinels active, so you can restart each Sentinel one after the other.

    However you said:

    There is no config set in the .conf file for the sentinel

    So the value is the default: 10000. However in the logs, when Sentinel is started, you may find that Sentinel had to tune the value to a lower value because the file limit for the process was set to a lower value.

    TLDR, you are able to check the current limit by:

    1. Checking the log file, the very first lines after the startup of the server.
    2. Assume 10k if you don't find anything else since this is the default.
    3. There is no API to query, while there is in Redis.