{"id":36173,"date":"2024-10-01T00:47:02","date_gmt":"2024-09-30T16:47:02","guid":{"rendered":"https:\/\/server.hk\/cnblog\/36173\/"},"modified":"2024-10-01T00:47:02","modified_gmt":"2024-09-30T16:47:02","slug":"apache%e5%ae%89%e5%85%a8%e7%ad%96%e7%95%a5%ef%bc%9a%e4%bd%bf%e7%94%a8mod_lbmethod_bybusyness%e9%80%b2%e8%a1%8c%e6%a5%ad%e5%8b%99%e8%b2%a0%e8%bc%89%e5%9d%87%e8%a1%a1","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/36173\/","title":{"rendered":"Apache\u5b89\u5168\u7b56\u7565\uff1a\u4f7f\u7528mod_lbmethod_bybusyness\u9032\u884c\u696d\u52d9\u8ca0\u8f09\u5747\u8861"},"content":{"rendered":"<h1 id=\"apache%e5%ae%89%e5%85%a8%e7%ad%96%e7%95%a5%ef%bc%9a%e4%bd%bf%e7%94%a8mod_lbmethod_bybusyness%e9%80%b2%e8%a1%8c%e6%a5%ad%e5%8b%99%e8%b2%a0%e8%bc%89%e5%9d%87%e8%a1%a1-eKHkHCdazx\">Apache\u5b89\u5168\u7b56\u7565\uff1a\u4f7f\u7528mod_lbmethod_bybusyness\u9032\u884c\u696d\u52d9\u8ca0\u8f09\u5747\u8861<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u74b0\u5883\u4e2d\uff0c\u7db2\u7ad9\u7684\u53ef\u7528\u6027\u548c\u6027\u80fd\u81f3\u95dc\u91cd\u8981\u3002Apache\u4f5c\u70ba\u4e00\u500b\u5ee3\u6cdb\u4f7f\u7528\u7684\u7db2\u9801\u4f3a\u670d\u5668\uff0c\u63d0\u4f9b\u4e86\u591a\u7a2e\u6a21\u7d44\u4f86\u5e6b\u52a9\u7ba1\u7406\u6d41\u91cf\u548c\u8ca0\u8f09\u3002\u5176\u4e2d\uff0c<code>mod_lbmethod_bybusyness<\/code>\u662f\u4e00\u500b\u5c08\u9580\u7528\u65bc\u8ca0\u8f09\u5747\u8861\u7684\u6a21\u7d44\uff0c\u80fd\u5920\u6839\u64da\u4f3a\u670d\u5668\u7684\u7e41\u5fd9\u7a0b\u5ea6\u4f86\u5206\u914d\u8acb\u6c42\uff0c\u5f9e\u800c\u63d0\u9ad8\u6574\u9ad4\u7cfb\u7d71\u7684\u6548\u7387\u548c\u7a69\u5b9a\u6027\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e8%b2%a0%e8%bc%89%e5%9d%87%e8%a1%a1%ef%bc%9f-eKHkHCdazx\">\u4ec0\u9ebc\u662f\u8ca0\u8f09\u5747\u8861\uff1f<\/h2>\n<p>\u8ca0\u8f09\u5747\u8861\u662f\u6307\u5c07\u9032\u5165\u7684\u7db2\u7d61\u6d41\u91cf\u5206\u914d\u5230\u591a\u500b\u4f3a\u670d\u5668\u4e0a\uff0c\u4ee5\u78ba\u4fdd\u6c92\u6709\u55ae\u4e00\u4f3a\u670d\u5668\u56e0\u904e\u8f09\u800c\u5c0e\u81f4\u6027\u80fd\u4e0b\u964d\u6216\u6545\u969c\u3002\u9019\u4e0d\u50c5\u80fd\u63d0\u9ad8\u7db2\u7ad9\u7684\u53ef\u7528\u6027\uff0c\u9084\u80fd\u63d0\u5347\u7528\u6236\u9ad4\u9a57\u3002Apache\u7684\u8ca0\u8f09\u5747\u8861\u6a21\u7d44\u63d0\u4f9b\u4e86\u591a\u7a2e\u65b9\u6cd5\u4f86\u5be6\u73fe\u9019\u4e00\u76ee\u6a19\uff0c\u5176\u4e2d<code>mod_lbmethod_bybusyness<\/code>\u662f\u6839\u64da\u4f3a\u670d\u5668\u7684\u7576\u524d\u8ca0\u8f09\u4f86\u9032\u884c\u8acb\u6c42\u5206\u914d\u7684\u4e00\u7a2e\u65b9\u6cd5\u3002<\/p>\n<h2 id=\"mod_lbmethod_bybusyness%e7%9a%84%e5%b7%a5%e4%bd%9c%e5%8e%9f%e7%90%86-eKHkHCdazx\">mod_lbmethod_bybusyness\u7684\u5de5\u4f5c\u539f\u7406<\/h2>\n<p><code>mod_lbmethod_bybusyness<\/code>\u901a\u904e\u76e3\u63a7\u6bcf\u500b\u4f3a\u670d\u5668\u7684\u7576\u524d\u8acb\u6c42\u6578\u91cf\u548c\u8655\u7406\u80fd\u529b\uff0c\u52d5\u614b\u5730\u5c07\u8acb\u6c42\u5206\u914d\u7d66\u6700\u4e0d\u7e41\u5fd9\u7684\u4f3a\u670d\u5668\u3002\u9019\u6a23\u53ef\u4ee5\u6709\u6548\u5730\u907f\u514d\u67d0\u4e9b\u4f3a\u670d\u5668\u56e0\u70ba\u8acb\u6c42\u904e\u591a\u800c\u5c0e\u81f4\u6027\u80fd\u4e0b\u964d\u3002<\/p>\n<p>\u5177\u9ad4\u4f86\u8aaa\uff0c\u9019\u500b\u6a21\u7d44\u6703\u6839\u64da\u4ee5\u4e0b\u5e7e\u500b\u6307\u6a19\u4f86\u8a55\u4f30\u4f3a\u670d\u5668\u7684\u7e41\u5fd9\u7a0b\u5ea6\uff1a<\/p>\n<ul>\n<li>\u7576\u524d\u8655\u7406\u7684\u8acb\u6c42\u6578\u91cf<\/li>\n<li>\u4f3a\u670d\u5668\u7684\u97ff\u61c9\u6642\u9593<\/li>\n<li>\u4f3a\u670d\u5668\u7684\u8cc7\u6e90\u4f7f\u7528\u60c5\u6cc1\uff08\u5982CPU\u548c\u5167\u5b58\uff09<\/li>\n<\/ul>\n<p>\u6839\u64da\u9019\u4e9b\u6307\u6a19\uff0c<code>mod_lbmethod_bybusyness<\/code>\u6703\u9078\u64c7\u4e00\u500b\u6700\u5408\u9069\u7684\u4f3a\u670d\u5668\u4f86\u8655\u7406\u65b0\u7684\u8acb\u6c42\uff0c\u5f9e\u800c\u5be6\u73fe\u8ca0\u8f09\u5747\u8861\u3002<\/p>\n<h2 id=\"%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%aemod_lbmethod_bybusyness-eKHkHCdazx\">\u5982\u4f55\u914d\u7f6emod_lbmethod_bybusyness<\/h2>\n<p>\u8981\u4f7f\u7528<code>mod_lbmethod_bybusyness<\/code>\uff0c\u9996\u5148\u9700\u8981\u78ba\u4fddApache\u5df2\u7d93\u5b89\u88dd\u4e86\u8a72\u6a21\u7d44\u3002\u63a5\u4e0b\u4f86\uff0c\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u6b65\u9a5f\u9032\u884c\u914d\u7f6e\uff1a<\/p>\n<pre><code>\n# \u555f\u7528\u6a21\u7d44\nLoadModule lbmethod_bybusyness_module modules\/mod_lbmethod_bybusyness.so\n\n# \u914d\u7f6e\u8ca0\u8f09\u5747\u8861\u5668\n&lt;Proxy balancer:\/\/mycluster&gt;\n    BalancerMember http:\/\/server1.example.com\n    BalancerMember http:\/\/server2.example.com\n    BalancerMember http:\/\/server3.example.com\n    ProxySet lbmethod=bybusyness\n&lt;\/Proxy&gt;\n<\/code><\/pre>\n<p>\u5728\u4e0a\u8ff0\u914d\u7f6e\u4e2d\uff0c\u6211\u5011\u5275\u5efa\u4e86\u4e00\u500b\u540d\u70ba<code>mycluster<\/code>\u7684\u8ca0\u8f09\u5747\u8861\u5668\uff0c\u4e26\u6dfb\u52a0\u4e86\u4e09\u500b\u4f3a\u670d\u5668\u4f5c\u70ba\u6210\u54e1\u3002\u901a\u904e\u8a2d\u7f6e<code>ProxySet lbmethod=bybusyness<\/code>\uff0c\u6211\u5011\u544a\u8a34Apache\u4f7f\u7528<code>mod_lbmethod_bybusyness<\/code>\u4f86\u9032\u884c\u8acb\u6c42\u5206\u914d\u3002<\/p>\n<h2 id=\"%e5%84%aa%e5%8b%a2%e8%88%87%e6%8c%91%e6%88%b0-eKHkHCdazx\">\u512a\u52e2\u8207\u6311\u6230<\/h2>\n<p>\u4f7f\u7528<code>mod_lbmethod_bybusyness<\/code>\u7684\u4e3b\u8981\u512a\u52e2\u5728\u65bc\u5176\u80fd\u5920\u6839\u64da\u5be6\u6642\u7684\u4f3a\u670d\u5668\u72c0\u614b\u9032\u884c\u52d5\u614b\u8abf\u6574\uff0c\u5f9e\u800c\u63d0\u9ad8\u6574\u9ad4\u7cfb\u7d71\u7684\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u3002\u7136\u800c\uff0c\u9019\u7a2e\u65b9\u6cd5\u4e5f\u6709\u5176\u6311\u6230\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\u9700\u8981\u6301\u7e8c\u76e3\u63a7\u4f3a\u670d\u5668\u7684\u6027\u80fd\u6307\u6a19\uff0c\u9019\u53ef\u80fd\u6703\u589e\u52a0\u7cfb\u7d71\u7684\u8907\u96dc\u6027\u3002<\/li>\n<li>\u5728\u9ad8\u6d41\u91cf\u60c5\u6cc1\u4e0b\uff0c\u4f3a\u670d\u5668\u7684\u72c0\u614b\u8b8a\u5316\u53ef\u80fd\u6703\u975e\u5e38\u983b\u7e41\uff0c\u5c0e\u81f4\u8ca0\u8f09\u5747\u8861\u7684\u6548\u679c\u4e0d\u5982\u9810\u671f\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-eKHkHCdazx\">\u7d50\u8ad6<\/h2>\n<p>\u7e3d\u7684\u4f86\u8aaa\uff0c<code>mod_lbmethod_bybusyness<\/code>\u662f\u4e00\u500b\u5f37\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e6b\u52a9\u7db2\u7ad9\u7ba1\u7406\u54e1\u6709\u6548\u5730\u7ba1\u7406\u4f3a\u670d\u5668\u8ca0\u8f09\uff0c\u63d0\u5347\u7db2\u7ad9\u6027\u80fd\u3002\u901a\u904e\u5408\u7406\u914d\u7f6e\u548c\u6301\u7e8c\u76e3\u63a7\uff0c\u9019\u4e00\u6a21\u7d44\u80fd\u5920\u70ba\u7528\u6236\u63d0\u4f9b\u66f4\u7a69\u5b9a\u7684\u670d\u52d9\u9ad4\u9a57\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684\u89e3\u6c7a\u65b9\u6848\u4f86\u7ba1\u7406\u60a8\u7684\u4f3a\u670d\u5668\uff0c\u8003\u616e\u4f7f\u7528\u6211\u5011\u7684<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u670d\u52d9\uff0c\u8b93\u60a8\u7684\u7db2\u7ad9\u5728\u9ad8\u6d41\u91cf\u4e0b\u4f9d\u7136\u4fdd\u6301\u7a69\u5b9a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3Apache\u5b89\u5168\u7b56\u7565\uff0c\u900f\u904emod_lbmethod_bybusyness\u5be6\u73fe\u9ad8\u6548\u696d\u52d9\u8ca0\u8f09\u5747\u8861\uff0c\u63d0\u5347\u4f3a\u670d\u5668\u6027\u80fd\u8207\u7a69\u5b9a\u6027\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-36173","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/36173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=36173"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/36173\/revisions"}],"predecessor-version":[{"id":36174,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/36173\/revisions\/36174"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=36173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=36173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=36173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}