Mercurial > hg > nginx-site
annotate xml/ru/docs/control.xml @ 2876:d8162f6cee38
Moved slack banner content to the default banner.
author | Sergey Budnevitch <sb@waeme.net> |
---|---|
date | Fri, 05 Aug 2022 12:21:34 +0400 |
parents | 52d603f58bca |
children |
rev | line source |
---|---|
580
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
461
diff
changeset
|
1 <!-- |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
461
diff
changeset
|
2 Copyright (C) Igor Sysoev |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
461
diff
changeset
|
3 Copyright (C) Nginx, Inc. |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
461
diff
changeset
|
4 --> |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
461
diff
changeset
|
5 |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
6 <!DOCTYPE article SYSTEM "../../../dtd/article.dtd"> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
7 |
123
7db449e89e92
Unified the use of the "name" attribute instead of "title".
Ruslan Ermilov <ru@nginx.com>
parents:
121
diff
changeset
|
8 <article name="Управление nginx" |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 link="/ru/docs/control.html" |
589 | 10 lang="ru" |
2195
52d603f58bca
Controlling nginx: removed history info from FreeBSD.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1465
diff
changeset
|
11 rev="7"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
12 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
13 <section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
14 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
15 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 Управлять nginx можно с помощью сигналов. Номер главного процесса по умолчанию |
271 | 17 записывается в файл <path>/usr/local/nginx/logs/nginx.pid</path>. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
18 Изменить имя этого файла можно при конфигурации сборки или же в |
271 | 19 <path>nginx.conf</path> директивой |
106
56457a474903
If text of the link is not provided, the @id is used.
Ruslan Ermilov <ru@nginx.com>
parents:
98
diff
changeset
|
20 <link doc="ngx_core_module.xml" id="pid"/>. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
21 Главный процесс поддерживает следующие сигналы: |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
22 <note> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 <table> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
25 <tr><td width="20%">TERM, INT</td><td>быстрое завершение</td></tr> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 <tr><td width="20%">QUIT</td><td>плавное завершение</td></tr> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 <tr><td width="20%">HUP</td><td>изменение конфигурации, |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
28 обновление изменившейся временной зоны (только для FreeBSD и Linux), |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
29 запуск новых рабочих процессов с новой конфигурацией, |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
30 плавное завершение старых рабочих процессов</td></tr> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
31 <tr><td width="20%">USR1</td><td>переоткрытие лог-файлов</td></tr> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
32 <tr><td width="20%">USR2</td><td>обновление исполняемого файла</td></tr> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
33 <tr><td width="20%">WINCH</td><td>плавное завершение рабочих процессов</td></tr> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
34 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
35 </table> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
36 </note> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
37 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
38 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
39 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
40 Управлять рабочими процессами по отдельности не нужно. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
41 Тем не менее, они тоже поддерживают некоторые сигналы: |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
42 <note> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
43 <table> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
44 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
45 <tr><td width="20%">TERM, INT</td><td>быстрое завершение</td></tr> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
46 <tr><td width="20%">QUIT</td><td>плавное завершение</td></tr> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
47 <tr><td width="20%">USR1</td><td>переоткрытие лог-файлов</td></tr> |
585
e83b551cb90e
Documented what WINCH signal does when sent to a worker process.
Ruslan Ermilov <ru@nginx.com>
parents:
580
diff
changeset
|
48 <tr><td width="20%">WINCH</td><td>аварийное завершение для отладки |
e83b551cb90e
Documented what WINCH signal does when sent to a worker process.
Ruslan Ermilov <ru@nginx.com>
parents:
580
diff
changeset
|
49 (требует включения <link doc="ngx_core_module.xml" id="debug_points"/>) |
e83b551cb90e
Documented what WINCH signal does when sent to a worker process.
Ruslan Ermilov <ru@nginx.com>
parents:
580
diff
changeset
|
50 </td></tr> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
51 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
52 </table> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
53 </note> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
54 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
55 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
56 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
57 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
58 |
121
49443032011c
Unified <section> syntax for "article" and "module" documents.
Ruslan Ermilov <ru@nginx.com>
parents:
109
diff
changeset
|
59 <section id="reconfiguration" name="Изменение конфигурации"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
60 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
61 <para> |
966 | 62 Для того чтобы nginx перечитал файл конфигурации, нужно послать |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
63 главному процессу сигнал HUP. Главный процесс сначала проверяет |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
64 синтаксическую правильность конфигурации, а затем пытается применить |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
65 новую конфигурацию, то есть, открыть лог-файлы и новые listen сокеты. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
66 Если ему это не удаётся, то он откатывает изменения и продолжает работать |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
67 со старой конфигурацией. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
68 Если же удаётся, то он запускает новые рабочие процессы, а старым |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
69 шлёт сообщение о плавном выходе. Старые рабочие процессы закрывают listen |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
70 сокеты и продолжают обслуживать старых клиентов. После обслуживания всех |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
71 клиентов старые рабочие процессы завершаются. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
72 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
73 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 <para> |
2195
52d603f58bca
Controlling nginx: removed history info from FreeBSD.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1465
diff
changeset
|
75 Предположим, на FreeBSD команда |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
76 <programlisting> |
838
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
77 ps axw -o pid,ppid,user,%cpu,vsz,wchan,command | egrep '(nginx|PID)' |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
78 </programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
79 показывает примерно такую картину: |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
80 <programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
81 PID PPID USER %CPU VSZ WCHAN COMMAND |
838
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
82 33126 1 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
83 33127 33126 nobody 0.0 1380 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
84 33128 33126 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 33129 33126 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
86 </programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
87 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
88 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
89 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
90 Если послать сигнал HUP главному процессу, то картина может быть такой: |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
91 <programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
92 PID PPID USER %CPU VSZ WCHAN COMMAND |
838
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
93 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx |
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
94 33129 33126 nobody 0.0 1380 kqread nginx: worker process is shutting down (nginx) |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
95 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
96 33135 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
97 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
98 </programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
99 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
100 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
101 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
102 Один старый рабочий процесс 33129 всё ещё продолжает работать. По истечении |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
103 некоторого времени он завершается: |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
104 <programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
105 PID PPID USER %CPU VSZ WCHAN COMMAND |
838
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
106 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
107 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
108 33135 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
109 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
110 </programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
111 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
113 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
114 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 |
121
49443032011c
Unified <section> syntax for "article" and "module" documents.
Ruslan Ermilov <ru@nginx.com>
parents:
109
diff
changeset
|
116 <section id="logs" name="Ротация лог-файлов"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
117 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
119 Лог-файлы нужно переименовать, а затем послать сигнал USR1 главному процессу. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 Он откроет заново все текущие открытые файлы и назначит им |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
121 в качестве владельца непривилегированного пользователя, под которым |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
122 работают рабочие процессы. После успешного открытия главный процесс |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
123 закрывает все открытые файлы и посылает сообщение о переоткрытии файлов |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
124 рабочим процессам. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
125 Они также открывают новые файлы и сразу же закрывают старые. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
126 В результате старые файлы практически сразу же готовы для дальнейшей |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
127 обработки, например, их можно сжимать. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
128 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
129 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
130 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
131 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
132 |
823
2d08f96e36cf
Paraphrased text about live upgrade of an executable file.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
133 <section id="upgrade" name="Обновление исполняемого файла на лету"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
134 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
135 <para> |
823
2d08f96e36cf
Paraphrased text about live upgrade of an executable file.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
136 Для обновления исполняемого файла сервера вначале нужно записать |
2d08f96e36cf
Paraphrased text about live upgrade of an executable file.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
137 на место старого файла новый. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
138 Затем нужно послать сигнал USR2 главному процессу—он |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
139 переименует свой файл с номером процесса в файл |
271 | 140 с суффиксом <path>.oldbin</path>, например, |
141 <path>/usr/local/nginx/logs/nginx.pid.oldbin</path>, | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
142 после чего запустит новый исполняемый файл, а тот в свою |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
143 очередь—свои рабочие процессы: |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
144 <programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
145 PID PPID USER %CPU VSZ WCHAN COMMAND |
838
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
146 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
147 33134 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
148 33135 33126 nobody 0.0 1380 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
149 33136 33126 nobody 0.0 1368 kqread nginx: worker process (nginx) |
838
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
150 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
151 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
152 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
153 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
154 </programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
155 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
156 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
157 <!-- |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
158 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
159 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
160 Процесс с новым исполняемым файлом 36264 создаёт свой файл с номером процесса |
271 | 161 с суффиксом <path>.newbin</path>, например, |
162 <path>/usr/local/nginx/logs/nginx.pid.newbin</path>. | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
163 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
164 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
165 --> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
166 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
167 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
168 Теперь все рабочие процессы наравне принимают запросы. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
169 Если послать сигнал WINCH первому главному процессу, то он пошлёт своим |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
170 рабочим процессам сообщение о плавном выходе, и они будут постепенно выходить: |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
171 <programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
172 PID PPID USER %CPU VSZ WCHAN COMMAND |
838
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
173 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx |
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
174 33135 33126 nobody 0.0 1380 kqread nginx: worker process is shutting down (nginx) |
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
175 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
176 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
177 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
178 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
179 </programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
180 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
181 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
182 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
183 По истечении времени запросы будут обрабатывать только новые рабочие процессы: |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
184 <programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
185 PID PPID USER %CPU VSZ WCHAN COMMAND |
838
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
186 33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx |
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
187 36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
188 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
189 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
190 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
191 </programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
192 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
193 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
194 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
195 Нужно заметить, что старый процесс не закрывает свои listen сокеты и при |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
196 необходимости ему можно сказать, чтобы он снова запустил свои рабочие процессы. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
197 Если работа нового исполняемого файла по каким-то причинам не устраивает, |
837
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
198 можно проделать одно из следующих действий: |
461 | 199 <list type="bullet"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
200 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
201 <listitem> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
202 <para> |
837
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
203 Послать старому главному процессу сигнал HUP. |
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
204 Старый главный процесс, не перечитывая конфигурации, |
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
205 запустит новые рабочие процессы. |
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
206 После этого можно плавно завершить все новые процессы, |
844
621d5dfcb4f4
Controlling nginx: fixed fallout from my rewrite of text.
Ruslan Ermilov <ru@nginx.com>
parents:
842
diff
changeset
|
207 послав новому главному процессу сигнал QUIT. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
208 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
209 </listitem> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
210 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
211 <listitem> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
212 <para> |
837
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
213 Послать новому главному процессу сигнал TERM. |
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
214 В ответ на это он пошлёт сообщение о немедленном выходе своим |
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
215 рабочим процессам, и все они практически сразу же завершатся. |
842
c9a425a3e4f5
Controlling nginx: be more precise about killing processes.
Ruslan Ermilov <ru@nginx.com>
parents:
838
diff
changeset
|
216 (Если новые процессы по каким-то причинам не завершаются, |
c9a425a3e4f5
Controlling nginx: be more precise about killing processes.
Ruslan Ermilov <ru@nginx.com>
parents:
838
diff
changeset
|
217 нужно послать им сигнал KILL, который заставит их завершиться.) |
837
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
218 По завершению нового главного процесса старый главный процесс |
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
219 автоматически запустит новые рабочие процессы. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
220 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
221 </listitem> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
222 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
223 </list> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
224 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
225 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
226 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
227 <para> |
837
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
228 Если новый главный процесс выходит, то старый главный процесс убирает |
271 | 229 суффикс <path>.oldbin</path> из имени файла с номером процесса. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
230 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
231 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
232 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
233 Если же обновление прошло удачно, то старому процессу нужно послать сигнал |
837
6678b1f27514
Improved readability of "Upgrading Executable on the Fly".
Ruslan Ermilov <ru@nginx.com>
parents:
823
diff
changeset
|
234 QUIT, и останутся только новые процессы: |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
235 <programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
236 PID PPID USER %CPU VSZ WCHAN COMMAND |
838
d1b5814e5265
Controlling nginx: use "ps -w" in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
837
diff
changeset
|
237 36264 1 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
238 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
239 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
240 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
241 </programlisting> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
242 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
243 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
244 <!-- |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
245 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
246 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
247 После этого остаётся только переименовать |
271 | 248 <path>/usr/local/nginx/logs/nginx.pid.newbin</path> в |
249 <path>/usr/local/nginx/logs/nginx.pid</path> и обновление можно считать | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
250 завершённым. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
251 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
252 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
253 --> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
254 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
255 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
256 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
257 </article> |