If Redis is running is sentinel-mode, which it e.g. does already after install on Ubuntu. Changing the config file and restarting sentinel results in sentinel overwriting the configuration.

A short description of the bug.

Install redis-sentinel (on Ubuntu) or start it. change the config restart sentinel config has been overwritten by sentinel

Expected behavior

Don't overwrite the config, or put the updated config in an extra file, which is marked as "Don't edit" like the cluster.conf

Additional information

The issue can be circumvented by stopping sentinel first, but this is not what is expected behaviour.

Comment From: oranagra

@Corvan sentinel was designed to maintain its config file whenever the configuration changes, so you're not suppose to edit it directly while sentinel is running.

doesn't the config file have the # Generated by CONFIG REWRITE line? which line are you referring to in cluster.conf?

Comment From: Corvan

Yes it does. But I ran into the problem on Ubuntu, that sentinel is started right away after installation. Then it determines localhost as redis master and writes that into the general config file. Afterwards I was not able to reconfigure it until I had stopped it, because with each reload, it overwrote the config I wanted to give to i, to be the "right" one.

I am referring to the general concept of cluster.conf. There the documentation states that cluster.conf is written by redis and it should not be touched. So maybe this could be a way for sentinel to keep the actual state, without rewriting the general configuration file.

I was able to work around this issue with stopping sentinel before configuring it. And I am aware that sentinel can be started from the command line with giving it a config. But especially in the context of configuration management, this is not feasable, because there you write the configuration and the start and maybe enable the service, to start at boot time. If the configuration is then afterwards altered by the service as well, you end up in unwanted behaviour. So maybe it might help to divide "static" configuration, done by the "user" and "dynamic" configuration done by the service.

Comment From: hwware

@Corvan Hello, for confiuring sentinel at run time , i think you can try using cli and change the sentinel config, maybe you can do the following steps for example: ./redis-cli -h -p 26379 127.0.0.1:26379> sentinel set mymaster down-after-milliseconds 3000 127.0.0.1:26379> sentinel flushconfig Then this way you can save your configuration. Thanks!

Comment From: Corvan

@hwware Thank you. Do I get this right, that you are proposing configuring redis (sentinel) rather per cli than per config file? While I was aware that it was possible, I did not yet think about configuring it via cli solely. Are there any drawbacks with this approach?

Comment From: oranagra

no drawbacks that i can think of. some advantages: - it remains alive and responsive the whole time (no restarts). - it will possibly reject any bad configuration (and keep using the old ones), rather than fail to start.

Comment From: hwware

@Corvan Hello Corvan, the configuration you manually put in config file was rewitten by running Sentinel since Sentinel did not load your information "at beginning" when it starts. Then if the Sentinel state changed, for example, a new configuration epoch was bumped, it will save the current state in the confiuration file and your changes manually put in config file will get rewitten. However when you using the cli approach and make sure you do "sentinel flushconfig", the configuration will immediately applied to the running Sentinel and persist in the configuration file, after you do this when you restart the Sentinel again, loading same config file, you shouldn't lost any config information then.

Comment From: Corvan

@oranagra @hwware Thank you very much, I'll try