nginx重启瞬间有请求进来,怎么办?

最近在看无中断更新系统,其中一个策略“滚动部署”,利用nginx来逐步停丢部分转发,来更新系统。

比较疑惑的是,如果在修改完nginx配置后,reload命令的瞬间,有请求进来,是不是这个请求就丢失了?

那这样还算是无中断更新系统吗?

阅读 306
评论
    1 个回答
    • 9.6k

    nginx -s reload 专门用来在线更新配置,并不需要重启。任何请求都不会丢失。

    In order for nginx to re-read the configuration file, a HUP signal should be sent to the master process. The master process first checks the syntax validity, then tries to apply new configuration, that is, to open log files and new listen sockets. If this fails, it rolls back changes and continues to work with old configuration. If this succeeds, it starts new worker processes, and sends messages to old worker processes requesting them to shut down gracefully. Old worker processes close listen sockets and continue to service old clients. After all clients are serviced, old worker processes are shut down.
      撰写回答

      登录后参与交流、获取后续更新提醒

      相似问题
      推荐文章