nginx添加新模块(nginx版本升级)
一、热部署(方案一)
1、查看原编译参数:
[root@node3 ~]# /usr/local/nginx/sbin/nginx -V
2、预编译/编译/安装
./configure --prefix=/usr/local/nginx
make && make install
3、直接升级
make upgrade
二、热部署(方案二)
1、查看原编译参数:
# 升级一般是添加新的模块,或者升级版本,所以要参考以前编译的模块,如果不添加,那么以前的模块就不
能使用了
[root@node3 ~]# /usr/local/nginx/sbin/nginx -V
2、预编译/编译/安装
./configure --prefix=/usr/local/nginx
make && make install
3、生成新的master进程
kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`
[root@node3 nginx-1.16.0]# ps -ef |grep "[n]ginx"
root
8054
1
0 21:07 ?
00:00:00 nginx: master process
/usr/local/nginx/sbin/nginx
nginx 8097 8054 0 21:09 ? 00:00:00 nginx: worker process
nginx 8098 8054 0 21:09 ? 00:00:00 nginx: worker process
root 8134 8054 0 21:13 ? 00:00:00 nginx: master process
/usr/local/nginx/sbin/nginx
nginx 8135 8134 0 21:13 ? 00:00:00 nginx: worker process
nginx 8136 8134 0 21:13 ? 00:00:00 nginx: worker process
4、优雅退出老worker进程
# 向老的master进程发信号:
[root@node3 nginx-1.16.0]# kill -WINCH 8054
[root@node3 nginx-1.16.0]# ps -ef |grep "[n]ginx"
root 8054 1 0 21:07 ? 00:00:00 nginx: master process
/usr/local/nginx/sbin/nginx
root 8134 8054 0 21:13 ? 00:00:00 nginx: master process
/usr/local/nginx/sbin/nginx
nginx 8135 8134 0 21:16 ? 00:00:00 nginx: worker process
nginx 8136 8134 0 21:16 ? 00:00:00 nginx: worker process
5、抉择
5.1、回滚
5.1.1、重新拉起老的worker进程
[root@node3 nginx-1.16.0]# kill -HUP 8054
[root@node3 nginx-1.16.0]# ps -ef |grep "[n]ginx"
root 8054 10 21:07 ?00:00:00 nginx: master process
/usr/local/nginx/sbin/nginx
root 8134 8054 0 21:13 ?00:00:00 nginx: master process
/usr/local/nginx/sbin/nginx
nginx 8135 8134 0 21:16 ? 00:00:00 nginx: worker process
nginx 8136 8134 0 21:16 ? 00:00:00 nginx: worker process
nginx 8154 8054 1 21:19 ? 00:00:00 nginx: worker process
nginx 8155 8054 1 21:19 ? 00:00:00 nginx: worker process
5.1.2、退出新的master进程
[root@node3 nginx-1.16.0]# kill -QUIT `cat /usr/local/nginx/logs/nginx.pid`
[root@node3 nginx-1.16.0]# ps -ef |grep "[n]ginx"
root 8054 10 21:07 ?00:00:00 nginx: master process
/usr/local/nginx/sbin/nginx
nginx 8154 8054 0 21:19 ? 00:00:00 nginx: worker process
nginx 8155 8054 0 21:19 ? 00:00:00 nginx: worker process
5.2新生
# 经过一段时间测试,服务器没问题,退出老的master:
[root@node3 nginx-1.16.0]# kill -QUIT 8054
[root@node3 nginx-1.16.0]# ps -ef |grep "[n]ginx"
root 8134 10 21:24 ? 00:00:00 nginx: master process
/usr/local/nginx/sbin/nginx
nginx 8135 8134 0 21:24 ? 00:00:00 nginx: worker process
nginx 8136 8134 0 21:24 ? 00:00:00 nginx: worker process
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。