Search code examples
redissentinelredis-sentinel

Sentinel configuration file


When adding a master to Sentinel, I always add the entries by editing sentinel.conf, but I often find out that application is being rewritten by another user (Sentinel).

I'm wondering if there is a more appropriate and an efficient way to add hosts to Sentinel without the need to edit the config file manually.


Solution

  • You can configure sentinel to monitor a new master at runtime.

    Example:

    SENTINEL MONITOR {cluster_name} {master_ip} {master_port} {quorum}
    SENTINEL SET {cluster_name} auth-pass {password}
    SENTINEL FLUSHCONFIG   # Force Sentinel to rewrite its configuration file
    

    For additional information check out the Redis Sentinel docs: https://redis.io/topics/sentinel#reconfiguring-sentinel-at-runtime

    Hope that helps!