nginx进程和实时控制
原文地址: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进程和实时控制的更多相关文章
- Nginx-->基础-->理论-->002:Nginx进程介绍
一.Nginx进程介绍
- Nginx-->基础-->理论-->nginx进程模型
一.nginx的进程模型基础 如上图,是nginx的基本进程模型. 1.nginx的master进程与worker进程关系 nginx的master进程负责worker进程的管理,包括创建worker ...
- Nginx学习笔记(八) Nginx进程启动分析
Nginx进程启动分析 worker子进程的执行循环的函数是ngx_worker_process_cycle (src/os/unix/ngx_process_cycle.c). 其中,捕获事件.分发 ...
- 【学习笔记】启动Nginx、查看nginx进程、查看nginx服务主进程的方式、Nginx服务可接受的信号、nginx帮助命令、Nginx平滑重启、Nginx服务器的升级
1.启动nginx的方式: cd /usr/local/nginx ls ./nginx -c nginx.conf 2.查看nginx的进程方式: [root@localhost nginx] ...
- 转载:2.1 运行中的Nginx进程间的关系《深入理解Nginx》(陶辉)
原文:https://book.2cto.com/201304/19624.html 在正式提供服务的产品环境下,部署Nginx时都是使用一个master进程来管理多个worker进程,一般情况下,w ...
- nginx——绑定 Nginx 进程到不同的 CPU 上
为什么要绑定 Nginx 进程到不同的 CPU 上 :默认情况下,Nginx 的多个进程有可能跑在某一个 CPU 或 CPU 的某一核上,导致 Nginx 进程使用硬件的资源不均,因此绑定 Nginx ...
- 使用nagios+python监控nginx进程数
1.编写python脚本监控nginx #!/usr/bin/python # -*- coding: utf-8 -*- import os, sys, time import string imp ...
- 设置NGINX进程分配至多核CPU提升性能
Nginx 配置文件 nginx.conf 首先需要找到 Nginx 的配置文件 nginx.conf 才能进行下面的操作,在LNMP一键安装包默认配置下,nginx.conf 存放在/usr/loc ...
- 统计nginx进程占用的物理内存
#!/usr/bin/env python #-*- coding:utf-8 -*- ''' 统计nginx进程占用的物理内存 ''' import os import sys import sub ...
随机推荐
- js 上传图片、压缩、旋转
亲测 <!doctype html> <html> <head> <meta charset="utf-8"> <title& ...
- 第2节 mapreduce深入学习:14、mapreduce数据压缩-使用snappy进行压缩
第2节 mapreduce深入学习:14.mapreduce数据压缩-使用snappy进行压缩 文件压缩有两大好处,节约磁盘空间,加速数据在网络和磁盘上的传输. 方式一:在代码中进行设置压缩 代码: ...
- thinkphp5验证码处理
1.确定项目目录>vendor>topthink>think-captcha目录存在 2.在config中添加验证码配置 //验证码配置 'captcha' => [ // 验 ...
- thinkphp5中vendor的使用?
1.创建处理数组的类ArrayList.php <?php /** * ArrayList实现类 * @author liu21st <liu21st@gmail.com> */ c ...
- 如何HTML标签和JS中设置CSS3 var变量
一.HTML标签中设置CSS变量 如下: <div style="--color: #cd0000;"> <img src="mm.jpg" ...
- 操作iframe的方法
子页面 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8&q ...
- jquery的$().each,$.each的区别02
在jquery中,遍历对象和数组,经常会用到$().each和$.each(),两个方法.两个方法是有区别的,从而这两个方法在针对不同的操作上,显示了各自的特点. $().each,对于这个方法,在d ...
- 升级openssh踩得坑
升级背景: 项目中使用的系统为CentOS6.8,经过漏洞扫描后发现openssh高危漏洞,具体描述如下:OpenSSH 7.2p2之前版本, sshd/ session.c/ do_setup_en ...
- python字典及相关操作
1.字典 1.1.字典特性 字典是一种key-value的数据类型.key必须可hash,必须为不可变数据类型,且必须是唯一的:value可以存放任意多个值.可修改.可以不唯一:字典是无序的,通过ke ...
- Codeforces704C. Black Widow
n<=1e5个值v,分别由<=1e5的m个变量中的1<=ki<=2个布尔变量xj(或某个变量取反)或起来组成,而所有的v异或起来为1,一个x不会在输入数据中出现超过2次,包括他 ...