原文地址:http://nginx.com/resources/admin-guide/processes-and-runtime-control/

Processes and Runtime Control

进程和实时控制

This section describes the processes NGINX starts at run time and how to control them.

本文讨论Nginx開始执行时的进程以及怎样控制这些进程。

Master and Worker Processes

主进程和工作进程

NGINX has one master process and one or more worker processes. If caching is enabled, the cache loader and cache manager processes
will also run.

Nginx 有一个主进程和至少一个工作进程。假设缓存开启,缓存载入器和缓存管理器进程也会执行。

The main purpose of the master process is to read and evaluate configuration files, as well as, maintaining worker processes.

主进程的主要工作就是读取和评估配置文件,同一时候操作工作进程。

The Worker processes do the actual processing of requests. NGINX relies on OS-dependent mechanisms to efficiently distribute requests among worker processes. The number of worker processes is defined in the nginx.conf file and may be fixed for
a given configuration or automatically adjusted to the number of available CPU cores (see worker_processes).

工作进程直接处理请求。Nginx依赖操作系统机制均衡地把请求分发到各工作进程。工作进程和数量在nginx.conf文件里定义,当然也能够设置为自己主动来依据可用的CPU内核进程调整(见worker_processes)。

Controlling nginx

控制Nginx

To reload your configuration, you can stop, or restart nginx, or send signals to the master process. A signal can be sent by running the NGINX executable with the -s parameter.

要重加载入你的配置。你能够停止,或者重新启动Nginx。或者发送一个信号给主进程。执行nginx并带着-s參数能发送一个信号给Nginx主进程。

nginx -s signal

When us -s the signal parameter may be one of the following:

-s 后接的信号參数为下面当中一个:

  • stop — fast shutdown  高速关闭
  • quit — graceful shutdown  优雅关闭
  • reopen — reopening the log files  重新启动日志文件
  • reload — reloading the configuration file  重载入配置文件

A signal can also be sent directly to the master process with the use of the kill utility. The process ID of the master process is written, by default, to the nginx.pid file, which is located in the /usr/local/nginx/logs or /var/run directory.

一个信号也可能直接使用kill工具发送给主进程。须要用到主进程的进程号,默认的在nginx.pid文件里,该文件可能放在/usr/local/nginx/logs或者/var/run文件夹下。

You can read more about advanced signals like log file reopening and live binary upgrades in the Controlling NGINX documentation.

你能够在 Controlling NGINX documentation 里找到很多其它的可用信号,比如重新启动日志文件和执行时二进制升级。

nginx进程和实时控制的更多相关文章

  1. Nginx-->基础-->理论-->002:Nginx进程介绍

    一.Nginx进程介绍

  2. Nginx-->基础-->理论-->nginx进程模型

    一.nginx的进程模型基础 如上图,是nginx的基本进程模型. 1.nginx的master进程与worker进程关系 nginx的master进程负责worker进程的管理,包括创建worker ...

  3. Nginx学习笔记(八) Nginx进程启动分析

    Nginx进程启动分析 worker子进程的执行循环的函数是ngx_worker_process_cycle (src/os/unix/ngx_process_cycle.c). 其中,捕获事件.分发 ...

  4. 【学习笔记】启动Nginx、查看nginx进程、查看nginx服务主进程的方式、Nginx服务可接受的信号、nginx帮助命令、Nginx平滑重启、Nginx服务器的升级

     1.启动nginx的方式: cd /usr/local/nginx ls ./nginx -c nginx.conf 2.查看nginx的进程方式: [root@localhost nginx] ...

  5. 转载:2.1 运行中的Nginx进程间的关系《深入理解Nginx》(陶辉)

    原文:https://book.2cto.com/201304/19624.html 在正式提供服务的产品环境下,部署Nginx时都是使用一个master进程来管理多个worker进程,一般情况下,w ...

  6. nginx——绑定 Nginx 进程到不同的 CPU 上

    为什么要绑定 Nginx 进程到不同的 CPU 上 :默认情况下,Nginx 的多个进程有可能跑在某一个 CPU 或 CPU 的某一核上,导致 Nginx 进程使用硬件的资源不均,因此绑定 Nginx ...

  7. 使用nagios+python监控nginx进程数

    1.编写python脚本监控nginx #!/usr/bin/python # -*- coding: utf-8 -*- import os, sys, time import string imp ...

  8. 设置NGINX进程分配至多核CPU提升性能

    Nginx 配置文件 nginx.conf 首先需要找到 Nginx 的配置文件 nginx.conf 才能进行下面的操作,在LNMP一键安装包默认配置下,nginx.conf 存放在/usr/loc ...

  9. 统计nginx进程占用的物理内存

    #!/usr/bin/env python #-*- coding:utf-8 -*- ''' 统计nginx进程占用的物理内存 ''' import os import sys import sub ...

随机推荐

  1. QStandardItemModel

    QString("%1").arg(g_PrjMg.m_Param.stRunParaSet.wWDTTimer) ///站号参数 model = new QStandardIte ...

  2. 并发-5CAS与AQS

    juc: java.util.concurrent 锁: 悲观锁:写的比较多,对数据的增删改,读(查)少.Lock 乐观锁:反之,读多写少.版本 并发编程之 CAS 的原理 什么是CAS CAS (c ...

  3. [Luogu] P1131 [ZJOI2007]时态同步

    题目描述 题目描述 小Q在电子工艺实习课上学习焊接电路板.一块电路板由若干个元件组成,我们不妨称之为节点,并将其用数字1,2,3…进行标号.电路板的各个节点由若干不相交的导线相连接,且对于电路板的任何 ...

  4. SCOI2013 密码

    题目描述: Fish是一条生活在海里的鱼.有一天他很无聊,就到处去寻宝.他找到了位于海底深处的宫殿,但是一扇带有密码锁的大门却阻止了他的前进. 通过翻阅古籍,Fish 得知了这个密码的相关信息: 该密 ...

  5. IO之DataStream数据流举例

    import java.io.*; public class TestDataStream { public static void main(String[] args) { ByteArrayOu ...

  6. css布局的各种FC简单介绍:BFC,IFC,GFC,FFC

    什么是FC? Formatting Context,格式化上下文,指页面中一个渲染区域,拥有一套渲染规则,它决定了其子元素如何定位,以及与其他元素的相互关系和作用. BFC 什么是BFC Block ...

  7. stark组件之删除页面内容搭建(八)

    删除页面没有太多的内容和功能 def del_view(self, request,pk,*args,**kwargs): """ 处理删除表弟 :param reque ...

  8. Quartz Spring分布式集群搭建Demo

    注:关于单节点的Quartz使用在这里不做详细介绍,直接进阶为分布式集群版的 1.准备工作: 使用环境Spring4.3.5,Quartz2.2.3,持久化框架JDBCTemplate pom文件如下 ...

  9. [OJ#39]左手右手

    [OJ#39]左手右手 试题描述 有 n 个人,每个人左右手上各写着一个整数.对于编号为 a 的人和编号为 b 的人, a 对 b 的好感度等于 a 左手上写的数字乘 b 右手上写的数字,a 和 b  ...

  10. Codeforces Round #264 (Div. 2) D

    题意: 给出最多5个序列,问这几个序列的最长公共子序列的长度是多少. solution : 脑抽级别我是,第一个序列每个数字位置固定,这样只要维护一个k-1维的偏序集就好了.然后在保证每个位置合法的情 ...