-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow hooks to be run before/after start/stop #31
Comments
Does it save when it receives a different signal? |
No. |
This ubuntu issue seems to indicate that there exists a version of Redis which does save at TERM, FWIW: http://code.google.com/p/redis/issues/detail?id=97 |
Yes, saving on TERM has been implemented already in Redis' master branch. That's why I said "As of the current version". Regardless of that, I still think the hooks would be a feature worth discussing. |
I'd suggest instead executing a script that registers a signal handler for TERM, spawns redis as a subprocess, then waits forever, and calls the save command then kills the subprocess when it gets a TERM. "pre" and "post" scripts are a little beyond supervisor's scope when it's easy enough to do this. |
Ah, you're right. I hadn't thought of that. |
Do you guys have an example of such script? I have the following use case: Plone site with multiple instances running behind a web accelerator like Varnish, using memmon and httpok. From time to time, memmon will need to restart an instance because of high memory consumption; Varnish has configured backend health check probes that test if the instances are available or not, and this probes have to play very nicely with the instances because requests hitting the backend are typically slow; for instance:
As restarting a Plone instance is a time consuming process (typically, around 30 seconds), Varnish will not notice the instance is down for some time and will continue sending requests; the instance then came in and will be flooded with a lot of pending requests from Varnish. The Varnish backend then behaves erratically for some time until the instance stabilizes. I would like to be able to configure something like this:
An additional step could be included before the last one to warm up the ZODB cache. |
I'm running redis with supervisord. (As of the current version) Redis doesn't save its database when it receives a TERM signal (or any other signal). This could be circumvented by having a pre-stop hook that could be used to run a command to save the database before sending the TERM signal.
I assume that this would be a useful feature for other use cases, too, so I'm proposing to add pre-start, post-start, post-start and pre-stop hooks to supervisord.
The text was updated successfully, but these errors were encountered: