zoukankan      html  css  js  c++  java
  • nginx热升级流程

    1. 替换二进制文件(编译安装时路径要保持一直,否则新老版本nginx 无法共享同一个配置文件)

    2. 向原nginx master 进程发送 USR2 信号。

    master 进程pid 会进行mv 操作 重命名为 pid.old.bin

    master 进程用新的二进制文件启动新的 nginx master 进程

    [root@node3 ~]# ps -ef |grep nginx
    root      1334     1  0 6月13 ?       00:00:00 nginx: master process /usr/sbin/nginx
    nginx     1978  1334  0 10:25 ?        00:00:00 nginx: worker process
    nginx     1979  1334  0 10:25 ?        00:00:00 nginx: worker process
    nginx     1980  1334  0 10:25 ?        00:00:00 nginx: cache manager process
    root      2013  1334  0 10:31 ?        00:00:00 nginx: master process /usr/sbin/nginx
    nginx     2014  2013  0 10:31 ?        00:00:00 nginx: worker process
    nginx     2015  2013  0 10:31 ?        00:00:00 nginx: worker process
    nginx     2016  2013  0 10:31 ?        00:00:00 nginx: cache manager process
    nginx     2017  2013  0 10:31 ?        00:00:00 nginx: cache loader process
    root      2055  1833  0 10:31 pts/0    00:00:00 grep --color=auto nginx


    [root@node3 ~]# ls -l /var/run/nginx.pid* | cat
    -rw-r--r--. 1 root root 5 6月 14 10:31 /var/run/nginx.pid
    -rw-r--r--. 1 root root 5 6月 13 23:31 /var/run/nginx.pid.oldbin

    3. 向 老nginx master 进程 发送 WINCH  信号原woker 进程停止

    [root@node3 ~]# ps -ef |grep nginx
    root      1334     1  0 6月13 ?       00:00:00 nginx: master process /usr/sbin/nginx
    root      2013  1334  0 10:31 ?        00:00:00 nginx: master process /usr/sbin/nginx
    nginx     2014  2013  0 10:31 ?        00:00:00 nginx: worker process
    nginx     2015  2013  0 10:31 ?        00:00:00 nginx: worker process
    nginx     2016  2013  0 10:31 ?        00:00:00 nginx: cache manager process
    nginx     2017  2013  0 10:31 ?        00:00:00 nginx: cache loader process
    root      2057  1833  0 10:32 pts/0    00:00:00 grep --color=auto nginx

    4. 回滚旧版本 

    kill -HUP  1334  reload 老进程

    kill -QUIT  2013  停止新的 master

    5. 继续使用 新版本

    kill -QUIT  2013

  • 相关阅读:
    Python:Fatal error in launcher: Unable to create process using 问题排查
    接口测试及接口Jmeter工具介绍
    bug的分类和等级
    如何编写测试用例
    网络流入门--最大流算法Dicnic 算法
    Codevs 1004 四子连棋
    洛谷 P1072 Hankson 的趣味题
    Codevs 搜索刷题 集合篇
    洛谷 P1195 口袋的天空
    洛谷 P1362 兔子数
  • 原文地址:https://www.cnblogs.com/leleyao/p/13124062.html
Copyright © 2011-2022 走看看