Supervisor \u914d\u7f6e<\/strong><\/div>\nPython \u9879\u76ee\u9ed8\u8ba4\u662f\u65e0\u6cd5\u76f4\u63a5\u5728\u540e\u53f0\u8fd0\u884c\u7684\uff0c\u53ef\u4ee5\u901a\u8fc7Supervisor \u7ba1\u7406\u7a0b\u5e8f\u8fdb\u884c\u63a7\u5236\u3002<\/p>\n
centos 7\u5b89\u88c5\u7684Supervisor \u914d\u7f6e\u53ef\u4ee5\u5728\/etc\/supervisord.d\/\u521b\u5efaxxx.ini \u6587\u4ef6\uff0ccentos 6\u76f4\u63a5\u5728\/etc\/supervisord.conf \u4e2d\u589e\u52a0\u914d\u7f6e\u3002<\/p>\n
\r\n[root@kvm webvirtmgr] vim \/etc\/supervisord.d\/webvirtmgr.ini\r\n[program:webvirtmgr]\r\ncommand=\/usr\/bin\/python \/home\/webvirtmgr\/manage.py run_gunicorn -c \/home\/webvirtmgr\/conf\/gunicorn.conf.py\r\ndirectory=\/home\/webvirtmgr\r\nautostart=true\r\nautorestart=true\r\nlogfile=\/var\/log\/supervisor\/webvirtmgr.log\r\nlog_stderr=true\r\nuser=nginx\r\n \r\n[program:webvirtmgr-console]\r\ncommand=\/usr\/bin\/python \/home\/webvirtmgr\/console\/webvirtmgr-console\r\ndirectory=\/home\/webvirtmgr\r\nautostart=true\r\nautorestart=true\r\nstdout_logfile=\/var\/log\/supervisor\/webvirtmgr-console.log\r\nredirect_stderr=true\r\nuser=nginx\r\n<\/pre>\n\u4e4b\u524d\u53cd\u590d\u6d4b\u8bd5\uff0csupervisor \u8fdb\u7a0b\u65e0\u6cd5\u542f\u52a8\u8be5\u9879\u76ee\uff0cPython \u6ca1\u6709\u76d1\u542c\u7aef\u53e3\uff0c\u67e5\u770b\u65e5\u5fd7\u4e5f\u6ca1\u6709\u5177\u4f53\u7684\u62a5\u9519\u4fe1\u606f\uff0c\u67e5\u4e86\u5f88\u4e45\u518d\u770b\u914d\u7f6e\u4fe1\u606f\u7684\u65f6\u5019\u53d1\u73b0user=nginx \u8fd9\u4e2a\u503c\uff0c\u60f3\u5230\u4e86webvirtmgr \u9879\u76ee\u7684\u6743\u9650\u662froot \u8d26\u6237\uff0cnginx \u8d26\u6237\u6ca1\u6709\u6267\u884c\u6743\u9650\uff0c\u91cd\u7f6e\u8d26\u6237\u4e3anginx\u540e\u89e3\u51b3\u3002<\/p>\n
\r\n[root@kvm home] chown nginx.nginx -R webvirtmgr\/\r\n[root@kvm home] service supervisord restart\r\n<\/pre>\n\u67e5\u770b\u7aef\u53e3\u76d1\u542c\u60c5\u51b5\uff1a<\/p>\n
\r\n[root@kvm home] netstat -tunlp | grep python\r\ntcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 1463\/python \r\ntcp 0 0 0.0.0.0:6080 0.0.0.0:* LISTEN 1462\/python\r\n<\/pre>\n\u914d\u7f6ewebvirtmgr \u8fde\u63a5KVM\u670d\u52a1\u5668<\/strong><\/div>\nwebvirtmgr \u8fde\u63a5kvm\u6709\u4e24\u79cd\u65b9\u5f0f\uff1aSSH\u548cTCP,TCP\u6a21\u5f0f\u6700\u4e3a\u7b80\u5355\u65b9\u4fbf\uff0c\u8fd9\u91cc\u5df2tcp\u8fde\u63a5\u4e3a\u4f8b\u3002<\/p>\n
\u8bbe\u7f6elibvirtd \u670d\u52a1\u76d1\u542c<\/strong><\/span><\/div>\n\u5728kvm\u670d\u52a1\u5668\u4e0a\u53d6\u6d88libvirtd \u670d\u52a1\u914d\u7f6e\u6587\u4ef6LIBVIRTD_ARGS \u524d\u7684\u6ce8\u91ca\u3000\/etc\/sysconfig\/libvirtd<\/p>\n
\r\n[root@kvm home] cp \/etc\/sysconfig\/libvirtd{,_bak} #\u5148\u5907\u4efd\u539f\u6587\u4ef6\u518d\u64cd\u4f5c\r\n[root@kvm home] vim \/etc\/sysconfig\/libvirtd\r\nLIBVIRTD_ARGS=\"--listen\"\r\n<\/pre>\n\u914d\u7f6elibvirt \u670d\u52a1<\/strong><\/span><\/div>\n\/etc\/libvirt\/libvirtd.conf \u5141\u8bb8\u901a\u8fc7tcp\u65b9\u5f0f\u901a\u8baf\uff0c\u4fee\u6539\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n
\r\n[root@kvm home] cp \/etc\/libvirt\/libvirtd.conf{,_bak} #\u5148\u5907\u4efd\u539f\u6587\u4ef6\u518d\u64cd\u4f5c\r\n[root@kvm home] vim \/etc\/libvirt\/libvirtd.conf\r\nlisten_tcp = 1 #\u5141\u8bb8tcp\u76d1\u542c\r\ntcp_port = \"16509\" #\u5f00\u653etcp\u7aef\u53e3\r\nlisten_addr = \"0.0.0.0\" #\u76d1\u542c\u5730\u5740\u4fee\u6539\u4e3a0.0.0.0\r\nauth_tcp = sasl #\u914d\u7f6etcp\u901a\u8fc7sasl\u8ba4\u8bc1\r\nlisten_tls = 0 #\u53d6\u6d88CA\u8ba4\u8bc1\u529f\u80fd\r\n<\/pre>\n\u542f\u52a8\u670d\u52a1\u3001\u521b\u5efalibvirt\u7ba1\u7406\u7528\u6237<\/strong><\/span><\/div>\n\r\n[root@kvm home] service libvirtd start\r\n[root@kvm home] saslpasswd2 -a libvirt admin #\u521b\u5efa\u7528\u6237admin \r\n<\/pre>\n\u5728\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u7684\u65f6\u5019\u51fa\u73b0\u8fc7\u7528sed\u547d\u4ee4\u76f4\u63a5\u66ff\u6362\u914d\u7f6e\u6587\u4ef6\u540e\u5bfc\u81f4libvirt\u65e0\u6cd5\u542f\u52a8\uff0c\u8fd8\u597d\u4e4b\u524d\u5907\u4efd\u4e86\u6587\u4ef6\uff0c\u901a\u8fc7vim \u7f16\u8f91\u5668\u624b\u52a8\u67e5\u627e\u4fee\u6539\u540e\u6b63\u5e38\u542f\u52a8\uff0c\u6240\u4ee5\u5bf9\u914d\u7f6e\u6587\u4ef6\u7684\u7f16\u8f91\u4fee\u6539\u524d\u8fdb\u884c\u5907\u4efd\u662f\u591a\u4e48\u91cd\u8981\u7684\u4e8b\u60c5\u3002<\/p>\n
<\/p>\n","protected":false},"excerpt":{"rendered":"
1.centos 7_64\u4f4d\u7cfb\u7edf\uff0c\u5173\u95edselinux \u3002 2.\u5df2\u7ecf\u6210\u529f\u5b89\u88c5KVM\u5e76\u521b\u5efa\u4e86VM\u865a\u62df\u673a\u3002 3.\u5b89\u88c5 […]<\/p>\n","protected":false},"author":668,"featured_media":38748,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-160862","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/160862","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=160862"}],"version-history":[{"count":9,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/160862\/revisions"}],"predecessor-version":[{"id":161614,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/160862\/revisions\/161614"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/38748"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=160862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=160862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=160862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}