前EMC高级软件工程师,现小米分布式存储码农,关注分布式存储,文件系统,Linux内核。微博: http://weibo.com/u/2203007022
分类: 系统运维
2014-05-30 13:31:50
[root@xxxxx sbin]# mv nginx nginx.old [root@xxxxxxsbin]# scp . password: nginx
[root@xxxxx sbin]# ll ../logs/ total 14392 -rw-r--r-- 1 guojun1 500 893 May 30 10:58 error.log -rw-r--r-- 1 guojun1 500 5617929 May 12 13:12 nginx-access.log -rw-r--r-- 1 guojun1 500 9102050 May 13 22:39 nginx-error.log -rw-r--r-- 1 root root 6 May 30 10:58 nginx.pid -rw-r--r-- 1 root root 6 May 30 10:58 nginx.pid.oldbin [root@xxxxxxxx sbin]# ps aux | grep nginx root 16236 0.0 0.0 92920 3064 ? Ss 10:58 0:00 nginx: master process ./nginx root 16237 0.0 0.0 94992 3988 ? S 10:58 0:00 nginx: worker process root 16238 0.0 0.0 94992 3988 ? S 10:58 0:00 nginx: worker process root 16239 0.0 0.0 94992 3988 ? S 10:58 0:00 nginx: worker process root 16385 0.0 0.0 92924 6072 ? S 10:58 0:00 nginx: master process ./nginx root 16386 0.0 0.0 94996 3908 ? S 10:58 0:00 nginx: worker process root 16387 0.0 0.0 94996 3980 ? S 10:58 0:00 nginx: worker process root 16388 0.0 0.0 94996 3980 ? S 10:58 0:00 nginx: worker process root 16445 0.0 0.0 103244 852 pts/4 S+ 10:58 0:00 grep nginxc) 向old master process发送SIGWINCH
[root@xxxxxxx sbin]# kill -s SIGWINCH 16236 [root@xxxxxxxx sbin]# ps aux | grep nginx root 16236 0.0 0.0 92920 3072 ? Ss 10:58 0:00 nginx: master process ./nginx root 16385 0.0 0.0 92924 6072 ? S 10:58 0:00 nginx: master process ./nginx root 16386 0.0 0.0 94996 3908 ? S 10:58 0:00 nginx: worker process root 16387 0.0 0.0 94996 3980 ? S 10:58 0:00 nginx: worker process root 16388 0.0 0.0 94996 3980 ? S 10:58 0:00 nginx: worker processd) 关闭old master
[root@xxxxxxxx sbin]# kill -s SIGQUIT 16236 [root@xxxxxxxx sbin]# ps aux | grep nginx root 16385 0.0 0.0 92924 6072 ? S 10:58 0:00 nginx: master process ./nginx root 16386 0.0 0.0 94996 3908 ? S 10:58 0:00 nginx: worker process root 16387 0.0 0.0 94996 3980 ? S 10:58 0:00 nginx: worker process root 16388 0.0 0.0 94996 3980 ? S 10:58 0:00 nginx: worker process
[root@lg-miui-file-mfs09 sbin]# ps aux | grep nginx root 16385 0.0 0.0 92924 6072 ? S 10:58 0:00 nginx: master process ./nginx root 44583 0.0 0.0 92924 6076 ? S 11:57 0:00 nginx: master process ./nginx root 44584 0.0 0.0 94996 3984 ? S 11:57 0:00 nginx: worker process root 44585 0.0 0.0 94996 3984 ? S 11:57 0:00 nginx: worker process root 44586 0.0 0.0 94996 3984 ? S 11:57 0:00 nginx: worker process root 44757 0.0 0.0 94996 3908 ? S 11:58 0:00 nginx: worker process root 44758 0.0 0.0 94996 3980 ? S 11:58 0:00 nginx: worker process root 44759 0.0 0.0 94996 3980 ? S 11:58 0:00 nginx: worker processb) 关闭新的master进程和worker进程
[root@lg-miui-file-mfs09 sbin]# kill -s SIGQUIT 44583 [root@lg-miui-file-mfs09 sbin]# ps aux | grep nginx root 16385 0.0 0.0 92924 6072 ? S 10:58 0:00 nginx: master process ./nginx root 44757 0.0 0.0 94996 3908 ? S 11:58 0:00 nginx: worker process root 44758 0.0 0.0 94996 3980 ? S 11:58 0:00 nginx: worker process root 44759 0.0 0.0 94996 3980 ? S 11:58 0:00 nginx: worker process如果新的master进程由于某些原因hung住了没有关闭,可以向它们发送SIGTERM或者SIGKILL信号。当新的master进程退出后,老的master进程会将nginx.pid.oldbin文件重命名为nginx.pid.