如何实现nginx运维过程中的无缝平滑升级?

2026-05-06 20:540阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计808个文字,预计阅读时间需要4分钟。

如何实现nginx运维过程中的无缝平滑升级?

相关专题

首先,使用新的可执行程序替换旧的(最好做好备份),然后,发送 USR2 (kill -USR2 pid)信号给主进程。

主进程将重命名它的 .pid 文件为 .oldbin (比如:/usr/local/nginx/logs/nginx.pid.oldbin),然后执行新的可执行程序,依次启动新的主进程和新的工作进程:

PID PPID USER %CPU VSZ WCHAN COMMAND 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) 33135 33126 nobody 0.0 1380 kqread nginx: worker process (nginx) 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx)

在这时,两个 nginx 实例会同时运行,一起处理输入的请求。

阅读全文
标签:Nginx

本文共计808个文字,预计阅读时间需要4分钟。

如何实现nginx运维过程中的无缝平滑升级?

相关专题

首先,使用新的可执行程序替换旧的(最好做好备份),然后,发送 USR2 (kill -USR2 pid)信号给主进程。

主进程将重命名它的 .pid 文件为 .oldbin (比如:/usr/local/nginx/logs/nginx.pid.oldbin),然后执行新的可执行程序,依次启动新的主进程和新的工作进程:

PID PPID USER %CPU VSZ WCHAN COMMAND 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) 33135 33126 nobody 0.0 1380 kqread nginx: worker process (nginx) 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx)

在这时,两个 nginx 实例会同时运行,一起处理输入的请求。

阅读全文
标签:Nginx