Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I change redis configuration via puppet, is there a better way to load the configuration other than restarting the redis service?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Yes you could do it, but it'll involve writing your own customer provider within Puppet. It's non trivial, but if you were willing to reduce the settings you cared about it would be simpler.

A simple case might be only setting master or slave dynamically. We'd make those parameters to your Redis class. We'd template the redis.conf of course and put these settings in it same as you're likely doing now. Then you'd need some sort of syntax like the following through the semantics should probably be more expressive.

redisconf { 'master': enable => 'true', } 

redisconf would be your custom provider that would be written in Ruby. It'll need to connect to the port of the Redis server (which is another input and default you'd need to set). Once you connect you'd need to issue an info and grab the resulting output as a hash.

First step is to determine what version of Redis you have. If it's 2.4/2.6 you can use config set and config get, else you'll use the hash we already have and run commands manually. In our example you'd check the value of role. If it's master, do nothing. If it's a slave then execute 'slaveof no one' and generate a Puppet event. Assuming there are differences the redisconf Puppet provider would need make changes and ideally verify or throw and error. Wrap the whole thing in Puppet-isms and you'd be set.

It would be a nice little project if you decided to take it on.

share|improve this answer
    
According to redis.io/topics/config (search for Changing Redis configuration while the server is running), Redis does not reload it's configuration. Only CONFIG SET is supported. –  François Beausoleil Jan 3 '13 at 17:12
    
That is correct which is why you have to build a custom type I called redisconf to do the changes directly to the running Redis deamon. I'll edit my answer and try to make that part clearer since I did gloss over it a bit. –  Ramin Jan 3 '13 at 18:35

No, a configuration reload is (currently) not possible.

If you manipulate settings which are adjustable via CONFIG SET you could set them in the running instance and just skip the restart.
I wouldn't advice doing that in normal situations though as you could break the configuration file and only notice it the next time you restart that instance.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.