{"id":3288,"date":"2012-12-21T13:30:11","date_gmt":"2012-12-21T11:30:11","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=3288"},"modified":"2016-01-08T19:27:28","modified_gmt":"2016-01-08T17:27:28","slug":"nginx-online-upgrade","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=3288","title":{"rendered":"[nginx] online upgrade"},"content":{"rendered":"<p>Nginx \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0434\u043d\u0451\u043c \u0432\u0441\u0451 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0435\u0435 \u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0435\u0435. \u0418 \u0432\u043e\u0442, \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c nginx \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 <strong>downtim&#8217;a<\/strong> \u0438<strong> restart&#8217;a<\/strong>. \u042d\u0442\u0438\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0445\u0432\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442.<\/p>\n<p><em><strong><span style=\"color: #008000;\">\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0442\u0435\u043d\u0434:<\/span><\/strong><\/em> <strong>FreeBSD 9.0 Release amd64, nginx-1.2.3<\/strong> (\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0441\u0442\u0430\u0432\u0448\u0438\u0439 <strong>1.2.6<\/strong>)<\/p>\n<p><!--more-->\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0440\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0439 nginx:<\/p>\n<pre># ps -auxww | grep nginx\r\nroot     34802   0.0  0.2  18788   2148  ??  Ss   12:36PM  0:00.00 nginx: master process \/usr\/local\/sbin\/nginx\r\nwww      34804   0.0  0.3  18788   2576  ??  S    12:36PM  0:00.00 nginx: worker process (nginx)\r\nwww      34805   0.0  0.3  18788   2576  ??  S    12:36PM  0:00.00 nginx: worker process (nginx)\r\nwww      34806   0.0  0.3  18788   2576  ??  S    12:36PM  0:00.00 nginx: worker process (nginx)\r\nwww      34807   0.0  0.3  18788   2572  ??  S    12:36PM  0:00.00 nginx: worker process (nginx)\r\n# nginx -v\r\nnginx version: nginx\/1.2.3<\/pre>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u043e\u0432\u043e\u0433\u043e <strong>nginx&#8217;a<\/strong> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0439\u0442\u0438 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438: \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438, \u043f\u043e\u0440\u0442\u044b, \u043f\u0430\u043a\u0435\u0442\u044b, \u043d\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u043e\u0440\u0442\u044b. \u041c\u043e\u0436\u043d\u043e \u0441\u043d\u0435\u0441\u0442\u0438 \u0441\u0442\u0430\u0440\u044b\u0439 \u0438 \u0437\u0430\u0438\u043d\u0441\u0442\u0430\u043b\u043b\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439, \u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0441\u043d\u043e\u0441\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439, \u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0440\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0430\u043a\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<p><code># echo 'FORCE_PKG_REGISTER=YES' &gt;&gt; \/etc\/make.conf<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0434\u0451\u043c \u0432 \u043f\u043e\u0440\u0442\u044b, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u0438 \u0441\u0442\u0430\u0432\u0438\u043c <strong>nginx<\/strong>. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u043c nginx&#8217;y \u0441\u0438\u0433\u043d\u0430\u043b <strong>USR2<\/strong> (\u044d\u0442\u043e\u0442 \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u043c\u0435\u0440 <strong>master pid&#8217;a<\/strong> \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <strong>master&#8217;a<\/strong>, \u0430 \u043e\u043d \u0443\u0436\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0430\u043c\u0438) \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b:<\/p>\n<pre>#nginx -v\r\nnginx version: nginx\/1.2.6\r\n# kill -USR2 `cat \/var\/run\/nginx.pid`\r\n# ps -auxww | grep nginx\r\nroot     31810   0.0  0.2  18792   2372  ??  S     1:05PM  0:00.00 nginx: master process \/usr\/local\/sbin\/nginx\r\nwww      31811   0.0  0.3  18792   2792  ??  S     1:05PM  0:00.00 nginx: worker process (nginx)\r\nwww      31812   0.0  0.3  18792   2792  ??  S     1:05PM  0:00.00 nginx: worker process (nginx)\r\nwww      31813   0.0  0.3  18792   2792  ??  S     1:05PM  0:00.00 nginx: worker process (nginx)\r\nwww      31814   0.0  0.3  18792   2788  ??  S     1:05PM  0:00.00 nginx: worker process (nginx)\r\nroot     34802   0.0  0.1  18788   1396  ??  Ss   12:36PM  0:00.00 nginx: master process \/usr\/local\/sbin\/nginx\r\nwww      34804   0.0  0.2  18788   1624  ??  S    12:36PM  0:00.08 nginx: worker process (nginx)\r\nwww      34805   0.0  0.2  18788   1624  ??  S    12:36PM  0:00.09 nginx: worker process (nginx)\r\nwww      34806   0.0  0.2  18788   1624  ??  S    12:36PM  0:00.08 nginx: worker process (nginx)\r\nwww      34807   0.0  0.2  18788   1544  ??  I    12:36PM  0:00.00 nginx: worker process (nginx)<\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u0435\u0441\u0442\u044c 2 \u043c\u0430\u0441\u0442\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430: \u043d\u043e\u0432\u044b\u0439 (<strong>pid=31810<\/strong>) \u0438 \u0441\u0442\u0430\u0440\u044b\u0439 (<strong>pid=34802<\/strong>)<br \/>\n\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u043c \u0441\u0438\u0433\u043d\u0430\u043b <strong>WINCH<\/strong> \u0441\u0442\u0430\u0440\u043e\u043c\u0443 <strong>master&#8217;y ngin&#8217;a<\/strong> (<strong>pid=34802<\/strong>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043c\u043a\u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:<\/p>\n<pre># kill -WINCH 34802\r\n# ps -auxww | grep nginx\r\nroot     31810   0.0  0.2  18792   2372  ??  I     1:05PM  0:00.00 nginx: master process \/usr\/local\/sbin\/nginx\r\nwww      31811   0.0  0.3  18792   2836  ??  I     1:05PM  0:00.00 nginx: worker process (nginx)\r\nwww      31812   0.0  0.3  18792   2792  ??  S     1:05PM  0:00.01 nginx: worker process (nginx)\r\nwww      31813   0.0  0.3  18792   2792  ??  S     1:05PM  0:00.01 nginx: worker process (nginx)\r\nwww      31814   0.0  0.3  18792   2788  ??  S     1:05PM  0:00.01 nginx: worker process (nginx)\r\nroot     34802   0.0  0.1  18788   1436  ??  Ss   12:36PM  0:00.00 nginx: master process \/usr\/local\/sbin\/nginx<\/pre>\n<p>\u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u043c \u0441\u0438\u0433\u043d\u0430\u043b <strong>QUIT<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0441\u0442\u0430\u0440\u044b\u0439 <strong>master<\/strong> \u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<pre># kill -QUIT 34802\r\n# ps -auxww | grep nginx\r\nroot     31810   0.0  0.2  18792   2372  ??  I     1:05PM  0:00.00 nginx: master process \/usr\/local\/sbin\/nginx\r\nwww      31811   0.0  0.3  18792   2836  ??  I     1:05PM  0:00.00 nginx: worker process (nginx)\r\nwww      31812   0.0  0.3  18792   2792  ??  S     1:05PM  0:00.01 nginx: worker process (nginx)\r\nwww      31813   0.0  0.3  18792   2792  ??  S     1:05PM  0:00.01 nginx: worker process (nginx)\r\nwww      31814   0.0  0.3  18792   2788  ??  S     1:05PM  0:00.01 nginx: worker process (nginx)<\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u043d\u043e\u0432\u044b\u0439 <strong>nginx<\/strong> \u0431\u0435\u0437 <strong>downtim&#8217;a<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nginx \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0434\u043d\u0451\u043c \u0432\u0441\u0451 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0435\u0435 \u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0435\u0435. \u0418 \u0432\u043e\u0442, \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c nginx \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 downtim&#8217;a \u0438 restart&#8217;a. \u042d\u0442\u0438\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0445\u0432\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442. \u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0442\u0435\u043d\u0434: FreeBSD 9.0 Release amd64, nginx-1.2.3 (\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0441\u0442\u0430\u0432\u0448\u0438\u0439 1.2.6)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-3288","post","type-post","status-publish","format-standard","hentry","category-www"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/3288","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3288"}],"version-history":[{"count":3,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/3288\/revisions"}],"predecessor-version":[{"id":4902,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/3288\/revisions\/4902"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}