{"id":5801,"date":"2021-12-05T19:50:58","date_gmt":"2021-12-05T11:50:58","guid":{"rendered":"http:\/\/www.gycysygg.icu\/?p=5801"},"modified":"2022-03-03T17:27:34","modified_gmt":"2022-03-03T09:27:34","slug":"supervisord","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2021\/12\/05\/supervisord\/","title":{"rendered":"supervisord\u79bb\u7ebf\u5b89\u88c5"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>\u7b80\u4ecb\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>supervisor<\/strong>\u662f\u4e00\u4e2a\u7528python\u8bed\u8a00\u7f16\u5199\u7684\u8fdb\u7a0b\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u76d1\u542c\u3001\u542f\u52a8\u3001\u505c\u6b62\u3001\u91cd\u542f\u4e00\u4e2a\u6216\u591a\u4e2a\u8fdb\u7a0b\u3002\u5f53\u4e00\u4e2a\u8fdb\u7a0b\u610f\u5916\u88ab\u6740\u6b7b\uff0csupervisor\u76d1\u542c\u5230\u8fdb\u7a0b\u6b7b\u540e\uff0c\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u8ba9\u8fdb\u7a0b\u81ea\u52a8\u6062\u590d\uff0c\u4e0d\u518d\u9700\u8981\u7a0b\u5e8f\u5458\u6216\u7cfb\u7edf\u7ba1\u7406\u5458\u81ea\u5df1\u7f16\u5199\u4ee3\u7801\u6765\u63a7\u5236\u3002<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>supervisor\u7684\u4e09\u4e2a\u91cd\u8981\u7684\u547d\u4ee4\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> <strong>supervisord <\/strong>\uff1a \u670d\u52a1\u7aef\uff0c \u8fd0\u884csupervisor\u65f6\u4f1a\u542f\u52a8\u4e00\u4e2a\u8fdb\u7a0bsupervisord\uff0c\u5b83\u8d1f\u8d23\u542f\u52a8\u6240\u7ba1\u7406\u7684\u8fdb\u7a0b\uff0c\u5e76\u5c06\u6240\u7ba1\u7406\u7684\u8fdb\u7a0b\u4f5c\u4e3a\u81ea\u5df1\u7684\u5b50\u8fdb\u7a0b\u6765\u542f\u52a8\uff0c\u800c\u4e14\u53ef\u4ee5\u5728\u6240\u7ba1\u7406\u7684\u8fdb\u7a0b\u51fa\u73b0\u5d29\u6e83\u65f6\u81ea\u52a8\u91cd\u542f <\/li><li><strong> supervisorctl \uff1a<\/strong> \u5ba2\u6237\u7aef\uff0c supervisorctl\u662f\u547d\u4ee4\u884c\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e0b\u9762\u547d\u4ee4\u6765\u8fdb\u884c\u5b50\u8fdb\u7a0b\u7684\u7ba1\u7406 \uff0c supervisorctl start|status|stop|restartm \u5b50\u8fdb\u7a0b\u540d\u5b57<\/li><li> <strong>echo_supervisord_conf <\/strong>\uff1a \u7528\u6765\u751f\u6210\u9ed8\u8ba4\u7684\u914d\u7f6e\u6587\u4ef6,\u4e00\u822c\u751f\u6210\u9ed8\u8ba4\u6587\u4ef6\u4e3a supervisor.conf <\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">supervisor\u662f\u7528python\u5199\u7684\u8fd0\u884c\u5728linux\u4e0b\u7684\u8fdb\u7a0b\u7ba1\u7406\u5de5\u5177\uff0c\u5b89\u88c5supervisor\u7684\u65f6\u5019\u4f9d\u8d56 python\u7684\u4e00\u4e9b\u5305\uff0c<strong>\u5b83\u4f9d\u8d56\uff1apython\u3001setuptools\u3001meld3<\/strong> <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u5c06\u5b89\u88c5\u5305\u4e0a\u4f20\u5230\u673a\u5668\u4e0a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rz supervisor-3.3.4.tar.gz\nrz  meld3-1.0.2.tar.gz       \/\/\u4f9d\u8d56\u5305\nrz setuptools-45.0.0.zip     \/\/\u4f9d\u8d56\u5305<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u5b89\u88c5setuptools\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unzip  setuptools-45.0.0.zip  \ncd  setuptools-45.0.0\npython setup.py install<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u5b89\u88c5meld<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar xf meld3-1.0.2.tar.gz\ncd meld3-1.0.2\npython setup.py install<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u5b89\u88c5supervisor<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar xf supervisor-3.3.4.tar.gz\ncd supervisor-3.3.4\npython setup.py install<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u521b\u5efa\u5fc5\u8981\u76ee\u5f55\u548c\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p \/etc\/supervisor\necho_supervisord_conf  &gt; \/etc\/supervisor\/supervisord.conf  \/\/\u751f\u6210\u914d\u7f6e\u6587\u4ef6<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">6\u3001\u53ef\u66f4\u6539\u7684\u8def\u5f84\u4f4d\u7f6e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u6ce8\u610f\uff1a\u5982\u679c\u524d\u9762\u6709\u7528\u5206\u53f7\";\"\u6ce8\u91ca\uff0c\u9700\u8981\u5148\u53bb\u6389\u5206\u53f7\u624d\u53ef\u4ee5\n&#91;unix_http_server]\nfile=\/tmp\/supervisor.sock    \/\/\u81ea\u5b9a\u4e49\u8def\u5f84\uff0c\u4e5f\u53ef\u9ed8\u8ba4\n&#91;supervisord]\nlogfile=\/tmp\/supervisord.log\npidfile=\/tmp\/supervisord.pid\n&#91;include]\nfiles = \/etc\/supervisor\/conf.d\/*.ini    \/\/\u53ef\u81ea\u5b9a\u4e49<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">7\u3001\u7f16\u5199\u670d\u52a1\u542f\u52a8\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/lib\/systemd\/system\/supervisord.service\n\n&#91;Unit] \nDescription=Supervisor daemon \n&#91;Service] \nType=forking \nExecStart=\/usr\/bin\/supervisord -c \/etc\/supervisor\/supervisord.conf \nExecStop=\/usr\/bin\/supervisorctl shutdown \nExecReload=\/usr\/bin\/supervisorctl reload \nKillMode=process \nRestart=on-failure \nRestartSec=42s \n&#91;Install] \nWantedBy=multi-user.target<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">8\u3001\u6267\u884c\u547d\u4ee4\u542f\u52a8supervisord:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start supervisord<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"701\" height=\"312\" src=\"http:\/\/www.gycysygg.icu\/wp-content\/uploads\/2021\/12\/7.png\" alt=\"\" class=\"wp-image-5812\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/12\/7.png 701w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/12\/7-300x134.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/12\/7-600x267.png 600w\" sizes=\"auto, (max-width: 701px) 100vw, 701px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u4ecb\uff1a supervisor\u662f\u4e00\u4e2a\u7528python\u8bed\u8a00\u7f16\u5199\u7684\u8fdb\u7a0b\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u76d1\u542c\u3001\u542f\u52a8\u3001\u505c\u6b62\u3001\u91cd\u542f\u4e00 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5811,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[148],"class_list":["post-5801","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-supervisord"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/5801","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=5801"}],"version-history":[{"count":13,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/5801\/revisions"}],"predecessor-version":[{"id":7400,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/5801\/revisions\/7400"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/5811"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=5801"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=5801"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=5801"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}