版本升级其实就是针对二进制文件的升级,过程如下:
- [root@nginx ~]# /usr/local/nginx-1.12.2/sbin/nginx -v
- nginx version: nginx/1.12.2
- [root@nginx ~]# cd /usr/local/nginx-1.12.2/sbin/
- [root@nginx sbin]# mv nginx nginx-1.12.2
- #首先备份原来的旧版本nginx二进制文件
- [root@nginx sbin]# cp /usr/local/nginx-1.14.2/sbin/nginx ./
- #拷贝新版本的二进制文件到当前目录
接下来进行平滑升级操作
- [root@nginx ~]# ps -ef|grep nginx
- root 6324 1 0 09:06 ? 00:00:00 nginx: master process /usr/local/nginx-1.12.2/sbin/nginx
- nobody 6325 6324 0 09:06 ? 00:00:00 nginx: worker process
- root 6338 1244 0 09:11 pts/0 00:00:00 grep --color=auto nginx
- [root@nginx ~]# kill -USR2 6324
- [root@nginx ~]# ps -ef|grep nginx
- root 6324 1 0 09:06 ? 00:00:00 nginx: master process /usr/local/nginx-1.12.2/sbin/nginx
- nobody 6325 6324 0 09:06 ? 00:00:00 nginx: worker process
- root 6340 6324 0 09:12 ? 00:00:00 nginx: master process /usr/local/nginx-1.12.2/sbin/nginx
- nobody 6341 6340 0 09:12 ? 00:00:00 nginx: worker process
- root 6343 1244 0 09:12 pts/0 00:00:00 grep --color=auto nginx
这时新的master进程已经正常开启,但老的work进程也存在,所以我们使用下面的命令,将老的work进程发出平滑停止的信号,如下:
- [root@nginx ~]# kill -WINCH 6324
- [root@nginx ~]# ps -ef|grep nginx
- root 6324 1 0 09:06 ? 00:00:00 nginx: master process /usr/local/nginx-1.12.2/sbin/nginx
- root 6340 6324 0 09:12 ? 00:00:00 nginx: master process /usr/local/nginx-1.12.2/sbin/nginx
- nobody 6341 6340 0 09:12 ? 00:00:00 nginx: worker process
- root 6346 1244 0 09:14 pts/0 00:00:00 grep --color=auto nginx
(编辑:西安站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|