{"id":74711,"date":"2024-10-15T22:45:16","date_gmt":"2024-10-15T14:45:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/74711\/"},"modified":"2024-10-15T22:45:16","modified_gmt":"2024-10-15T14:45:16","slug":"mysql-proxy%e8%ae%80%e5%af%ab%e5%88%86%e9%9b%a2%e5%a6%82%e4%bd%95%e9%81%8b%e8%a1%8c%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/74711\/","title":{"rendered":"MySQL Proxy\u8b80\u5beb\u5206\u96e2\u5982\u4f55\u904b\u884c\uff1f"},"content":{"rendered":"<h1 id=\"mysql-proxy%e8%ae%80%e5%af%ab%e5%88%86%e9%9b%a2%e5%a6%82%e4%bd%95%e9%81%8b%e8%a1%8c%ef%bc%9f-MPVWCMWXcD\">MySQL Proxy\u8b80\u5beb\u5206\u96e2\u5982\u4f55\u904b\u884c\uff1f<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u64da\u9a45\u52d5\u6642\u4ee3\uff0c\u6578\u64da\u5eab\u7684\u6027\u80fd\u548c\u53ef\u64f4\u5c55\u6027\u5c0d\u65bc\u61c9\u7528\u7a0b\u5e8f\u7684\u6210\u529f\u81f3\u95dc\u91cd\u8981\u3002MySQL\u4f5c\u70ba\u4e00\u500b\u6d41\u884c\u7684\u958b\u6e90\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u7d93\u5e38\u88ab\u7528\u65bc\u5404\u7a2e\u61c9\u7528\u4e2d\u3002\u96a8\u8457\u7528\u6236\u6578\u91cf\u7684\u589e\u52a0\uff0c\u6578\u64da\u5eab\u7684\u8b80\u53d6\u548c\u5beb\u5165\u64cd\u4f5c\u4e5f\u96a8\u4e4b\u589e\u9577\uff0c\u9019\u4f7f\u5f97\u8b80\u5beb\u5206\u96e2\u6210\u70ba\u4e00\u7a2e\u6709\u6548\u7684\u89e3\u6c7a\u65b9\u6848\u3002\u672c\u6587\u5c07\u63a2\u8a0eMySQL Proxy\u7684\u8b80\u5beb\u5206\u96e2\u5982\u4f55\u904b\u884c\uff0c\u4ee5\u53ca\u5176\u80cc\u5f8c\u7684\u6280\u8853\u539f\u7406\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afmysql-proxy%ef%bc%9f-MPVWCMWXcD\">\u4ec0\u9ebc\u662fMySQL Proxy\uff1f<\/h2>\n<p>MySQL Proxy\u662f\u4e00\u7a2e\u4e2d\u4ecb\u8edf\u4ef6\uff0c\u4f4d\u65bc\u5ba2\u6236\u7aef\u548cMySQL\u4f3a\u670d\u5668\u4e4b\u9593\u3002\u5b83\u7684\u4e3b\u8981\u529f\u80fd\u662f\u6514\u622a\u5ba2\u6236\u7aef\u7684\u8acb\u6c42\uff0c\u4e26\u6839\u64da\u8acb\u6c42\u7684\u985e\u578b\uff08\u8b80\u53d6\u6216\u5beb\u5165\uff09\u5c07\u5176\u8f49\u767c\u5230\u76f8\u61c9\u7684\u4f3a\u670d\u5668\u3002\u9019\u6a23\u7684\u67b6\u69cb\u53ef\u4ee5\u6709\u6548\u5730\u5be6\u73fe\u8b80\u5beb\u5206\u96e2\uff0c\u5f9e\u800c\u63d0\u9ad8\u6578\u64da\u5eab\u7684\u6027\u80fd\u548c\u53ef\u7528\u6027\u3002<\/p>\n<h2 id=\"%e8%ae%80%e5%af%ab%e5%88%86%e9%9b%a2%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5-MPVWCMWXcD\">\u8b80\u5beb\u5206\u96e2\u7684\u57fa\u672c\u6982\u5ff5<\/h2>\n<p>\u8b80\u5beb\u5206\u96e2\u662f\u6307\u5c07\u6578\u64da\u5eab\u7684\u8b80\u53d6\u64cd\u4f5c\u548c\u5beb\u5165\u64cd\u4f5c\u5206\u958b\u8655\u7406\u3002\u901a\u5e38\uff0c\u4e3b\u4f3a\u670d\u5668\u8ca0\u8cac\u8655\u7406\u6240\u6709\u7684\u5beb\u5165\u8acb\u6c42\uff0c\u800c\u4e00\u500b\u6216\u591a\u500b\u5f9e\u4f3a\u670d\u5668\u5247\u8ca0\u8cac\u8655\u7406\u8b80\u53d6\u8acb\u6c42\u3002\u9019\u6a23\u7684\u8a2d\u8a08\u53ef\u4ee5\u6e1b\u5c11\u4e3b\u4f3a\u670d\u5668\u7684\u8ca0\u64d4\uff0c\u63d0\u9ad8\u6574\u9ad4\u7cfb\u7d71\u7684\u6027\u80fd\u3002<\/p>\n<h3 id=\"%e8%ae%80%e5%af%ab%e5%88%86%e9%9b%a2%e7%9a%84%e5%84%aa%e5%8b%a2-MPVWCMWXcD\">\u8b80\u5beb\u5206\u96e2\u7684\u512a\u52e2<\/h3>\n<ul>\n<li><strong>\u6027\u80fd\u63d0\u5347\uff1a<\/strong>\u901a\u904e\u5c07\u8b80\u53d6\u8acb\u6c42\u5206\u6563\u5230\u591a\u500b\u5f9e\u4f3a\u670d\u5668\u4e0a\uff0c\u53ef\u4ee5\u986f\u8457\u63d0\u9ad8\u7cfb\u7d71\u7684\u97ff\u61c9\u901f\u5ea6\u3002<\/li>\n<li><strong>\u53ef\u64f4\u5c55\u6027\uff1a<\/strong>\u96a8\u8457\u7528\u6236\u6578\u91cf\u7684\u589e\u52a0\uff0c\u53ef\u4ee5\u8f15\u9b06\u5730\u6dfb\u52a0\u66f4\u591a\u7684\u5f9e\u4f3a\u670d\u5668\u4f86\u8655\u7406\u8b80\u53d6\u8acb\u6c42\u3002<\/li>\n<li><strong>\u6545\u969c\u5bb9\u5fcd\uff1a<\/strong>\u5982\u679c\u4e3b\u4f3a\u670d\u5668\u51fa\u73fe\u6545\u969c\uff0c\u7cfb\u7d71\u4ecd\u7136\u53ef\u4ee5\u901a\u904e\u5f9e\u4f3a\u670d\u5668\u63d0\u4f9b\u8b80\u53d6\u670d\u52d9\u3002<\/li>\n<\/ul>\n<h2 id=\"mysql-proxy%e7%9a%84%e5%b7%a5%e4%bd%9c%e5%8e%9f%e7%90%86-MPVWCMWXcD\">MySQL Proxy\u7684\u5de5\u4f5c\u539f\u7406<\/h2>\n<p>MySQL Proxy\u7684\u5de5\u4f5c\u6d41\u7a0b\u53ef\u4ee5\u5206\u70ba\u4ee5\u4e0b\u5e7e\u500b\u6b65\u9a5f\uff1a<\/p>\n<ol>\n<li><strong>\u8acb\u6c42\u6514\u622a\uff1a<\/strong>\u7576\u5ba2\u6236\u7aef\u767c\u9001\u8acb\u6c42\u6642\uff0cMySQL Proxy\u6703\u6514\u622a\u8a72\u8acb\u6c42\u3002<\/li>\n<li><strong>\u8acb\u6c42\u5206\u6790\uff1a<\/strong>\u6839\u64da\u8acb\u6c42\u7684\u985e\u578b\uff0cMySQL Proxy\u6703\u5224\u65b7\u8a72\u8acb\u6c42\u662f\u8b80\u53d6\u9084\u662f\u5beb\u5165\u3002<\/li>\n<li><strong>\u8acb\u6c42\u8f49\u767c\uff1a<\/strong>\u5c07\u8b80\u53d6\u8acb\u6c42\u8f49\u767c\u5230\u5f9e\u4f3a\u670d\u5668\uff0c\u5c07\u5beb\u5165\u8acb\u6c42\u8f49\u767c\u5230\u4e3b\u4f3a\u670d\u5668\u3002<\/li>\n<li><strong>\u7d50\u679c\u8fd4\u56de\uff1a<\/strong>\u5c07\u5f9e\u4f3a\u670d\u5668\u6216\u4e3b\u4f3a\u670d\u5668\u7684\u97ff\u61c9\u7d50\u679c\u8fd4\u56de\u7d66\u5ba2\u6236\u7aef\u3002<\/li>\n<\/ol>\n<h3 id=\"%e7%a4%ba%e4%be%8b%e4%bb%a3%e7%a2%bc-MPVWCMWXcD\">\u793a\u4f8b\u4ee3\u78bc<\/h3>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684MySQL Proxy\u914d\u7f6e\u793a\u4f8b\uff1a<\/p>\n<pre><code>\n# MySQL Proxy\u914d\u7f6e\u793a\u4f8b\n[mysql-proxy]\nuser = \"proxy_user\"\npassword = \"proxy_password\"\n\n[read]\ntype = \"read\"\nhost = \"slave_host\"\nport = 3306\n\n[write]\ntype = \"write\"\nhost = \"master_host\"\nport = 3306\n<\/code><\/pre>\n<p>\u5728\u9019\u500b\u914d\u7f6e\u4e2d\uff0c\u6211\u5011\u5b9a\u7fa9\u4e86\u4e3b\u4f3a\u670d\u5668\u548c\u5f9e\u4f3a\u670d\u5668\u7684\u9023\u63a5\u4fe1\u606f\u3002MySQL Proxy\u6703\u6839\u64da\u8acb\u6c42\u7684\u985e\u578b\u81ea\u52d5\u9078\u64c7\u76f8\u61c9\u7684\u4f3a\u670d\u5668\u9032\u884c\u8655\u7406\u3002<\/p>\n<h2 id=\"%e7%b5%90%e8%ab%96-MPVWCMWXcD\">\u7d50\u8ad6<\/h2>\n<p>MySQL Proxy\u7684\u8b80\u5beb\u5206\u96e2\u6280\u8853\u80fd\u5920\u6709\u6548\u63d0\u5347\u6578\u64da\u5eab\u7684\u6027\u80fd\u548c\u53ef\u64f4\u5c55\u6027\u3002\u901a\u904e\u5c07\u8b80\u53d6\u548c\u5beb\u5165\u64cd\u4f5c\u5206\u958b\u8655\u7406\uff0c\u7cfb\u7d71\u80fd\u5920\u66f4\u597d\u5730\u61c9\u5c0d\u9ad8\u4e26\u767c\u7684\u8acb\u6c42\uff0c\u5f9e\u800c\u63d0\u9ad8\u7528\u6236\u9ad4\u9a57\u3002\u96a8\u8457\u696d\u52d9\u7684\u589e\u9577\uff0c\u5be6\u65bd\u8b80\u5beb\u5206\u96e2\u5c07\u6210\u70ba\u4e00\u500b\u660e\u667a\u7684\u9078\u64c7\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5c0d\u65bc\u5982\u4f55\u5728\u60a8\u7684\u7cfb\u7d71\u4e2d\u5be6\u65bd\u9019\u7a2e\u6280\u8853\u6709\u8208\u8da3\uff0c\u6216\u8005\u60f3\u4e86\u89e3\u66f4\u591a\u95dc\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u7684\u4fe1\u606f\uff0c\u8acb\u96a8\u6642\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3MySQL Proxy\u7684\u8b80\u5beb\u5206\u96e2\u904b\u884c\u539f\u7406\uff0c\u63d0\u5347\u6578\u64da\u5eab\u6027\u80fd\u8207\u8ca0\u8f09\u5747\u8861\uff0c\u5be6\u73fe\u9ad8\u6548\u6578\u64da\u8655\u7406\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-74711","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/74711","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"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=74711"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/74711\/revisions"}],"predecessor-version":[{"id":74712,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/74711\/revisions\/74712"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=74711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=74711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=74711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}