nginx的平滑升级
方案(一)
1. 查看原编译参数
[root@anonymous ~]# nginx -V
[root@anonymous ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module
2. 解压缩,进入软件安装目录,添加echo-nginx-module模块
预编译/编译/安装:
[root@anonymous ~]# tar xf nginx-1.20.1.tar.gz
[root@anonymous ~]# cd nginx-1.20.1
[root@anonymous nginx-1.20.1]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --add-module=/usr/src/echo-nginx-module
root@anonymous nginx-1.20.1]# make && make install
3. 直接升级:make upgrade
方案(二)
1. 查看原编译参数
[root@anonymous ~]# nginx -V
[root@anonymous ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module
2. 解压缩,进入软件安装目录,添加echo-nginx-module模块
预编译/编译/安装:
[root@anonymous ~]# tar xf nginx-1.20.1.tar.gz
[root@anonymous ~]# cd nginx-1.20.1
[root@anonymous nginx-1.20.1]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --add-module=/usr/src/echo-nginx-module
root@anonymous nginx-1.20.1]# 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@anonymous nginx-1.20.1]# kill -WINCH 8054
[root@anonymous nginx-1.20.1]# 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@anonymous nginx-1.20.1]# kill -HUP 8054
[root@anonymous nginx-1.20.1]# 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
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@anonymous nginx-1.20.1]# kill -QUIT `cat /usr/local/nginx/logs/nginx.pid`
[root@anonymous nginx-1.20.1]# ps -ef |grep "[n]ginx"
root 8054 1 0 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@anonymous nginx-1.20.1]# kill -QUIT 8054
root@anonymous nginx-1.20.1]# ps -ef |grep "[n]ginx"
root 8134 1 0 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
nginx的平滑升级
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:nginx配置文件的解读
下一篇:Nginx的CA认证搭建与应用
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
nginx升级(简单、平滑、无需关闭服务)
nginx平滑升级
nginx 新版本 上传 -
linux平滑升级nginx sudo nginx的平滑升级
如果我们需要对当前的Nginx服务进行升级 ,应用新的模块,最简单的方式是停下来,然后开启新的Nginx服务,那么给我们的用户体验是非常差的,会导致用户在一段时间内无法访问我们的服务器为了解决这个问题,Nginx提供了平滑升级的方案。 为了实现nginx服务器的平滑升级
linux平滑升级nginx sudo linux nginx Nginx 服务器 -
linux c sqlite 查询
DML语句使用source 路径 :把SQL脚本导入到数据库中查询语句类型:【简单查询|多表查询|子查询】投影:select 字段名,字段名 from 表名 where 条件 :作对比选择:select &nb
linux c sqlite 查询 mysql ci 字段 子查询