Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you don't care about uptime just replace the old binary with the new binary and then restart the server.

This is from a book called "Nginx HTTP server":

1. Replace the old Nginx binary (by default, /usr/local/nginx/sbin/nginx) with the new one.

2. Find the pid of the Nginx master process, for example, with ps x | grep nginx | grep master or by looking at the value found in the pid file.

3. Send a USR2 (12) signal to the master process—kill –USR2 , replacing with the pid found in step 2. This will initiate the upgrade by renaming the old .pid file and running the new binary.

4. Send a WINCH (28) signal to the old master process—kill –WINCH , replacing with the pid found in step 2. This will engage a graceful shutdown of the old worker processes.

5. Make sure that all the old worker processes are terminated, and then send a QUIT signal to the old master process—kill –QUIT , replacing with the pid found in step 2.



The above steps aren't optimal.

The makefile in the nginx source shows you how to do a hitless upgrade. This is what I do from the shell after correctly installing, essentially translated from the makefile.

kill -USR2 `cat /var/run/nginx.pid` && sleep 1 && test -f /var/run/nginx.pid.oldbin && kill -QUIT `cat /var/run/nginx.pid.oldbin` && echo restart successful

Obviously, modify paths to the pid files as appropriate.


Actually, this is from nginx documentation: http://nginx.org/en/docs/control.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: