{"id":186460,"date":"2024-11-11T06:06:20","date_gmt":"2024-11-10T22:06:20","guid":{"rendered":"https:\/\/server.hk\/cnblog\/186460\/"},"modified":"2024-11-11T06:06:21","modified_gmt":"2024-11-10T22:06:21","slug":"%e6%95%b8%e6%93%9a%e5%ba%ab%e8%ae%80%e5%af%ab%e5%88%86%e9%9b%a2%e4%b8%ad%e9%96%93%e4%bb%b6%e6%8e%a8%e8%96%a6%e5%bd%99%e7%b8%bd%ef%bc%88%e6%95%b8%e6%93%9a%e5%ba%ab%e8%ae%80%e5%af%ab%e5%88%86%e9%9b%a2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/186460\/","title":{"rendered":"\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\u63a8\u85a6\u5f59\u7e3d\uff08\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\u6709\u54ea\u4e9b\uff09"},"content":{"rendered":"<h1 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e8%ae%80%e5%af%ab%e5%88%86%e9%9b%a2%e4%b8%ad%e9%96%93%e4%bb%b6%e6%8e%a8%e8%96%a6%e5%bd%99%e7%b8%bd%ef%bc%88%e6%95%b8%e6%93%9a%e5%ba%ab%e8%ae%80%e5%af%ab%e5%88%86%e9%9b%a2-pmpnJEGLzg\">\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\u63a8\u85a6\u5f59\u7e3d\uff08\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\u6709\u54ea\u4e9b\uff09<\/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\u4f01\u696d\u7684\u6210\u529f\u81f3\u95dc\u91cd\u8981\u3002\u96a8\u8457\u7528\u6236\u6578\u91cf\u7684\u589e\u52a0\u548c\u6578\u64da\u91cf\u7684\u64f4\u5927\uff0c\u55ae\u4e00\u6578\u64da\u5eab\u7684\u8b80\u5beb\u8ca0\u8f09\u53ef\u80fd\u6703\u6210\u70ba\u74f6\u9838\u3002\u70ba\u4e86\u89e3\u6c7a\u9019\u4e00\u554f\u984c\uff0c\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u6280\u8853\u61c9\u904b\u800c\u751f\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\u7684\u6982\u5ff5\u53ca\u5176\u63a8\u85a6\u7684\u5e7e\u7a2e\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e6%95%b8%e6%93%9a%e5%ba%ab%e8%ae%80%e5%af%ab%e5%88%86%e9%9b%a2%ef%bc%9f-pmpnJEGLzg\">\u4ec0\u9ebc\u662f\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\uff1f<\/h2>\n<p>\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u662f\u6307\u5c07\u6578\u64da\u5eab\u7684\u8b80\u53d6\u64cd\u4f5c\u548c\u5beb\u5165\u64cd\u4f5c\u5206\u958b\u8655\u7406\u7684\u6280\u8853\u3002\u901a\u5e38\uff0c\u4e3b\u6578\u64da\u5eab\u8ca0\u8cac\u5beb\u5165\u64cd\u4f5c\uff0c\u800c\u5f9e\u6578\u64da\u5eab\u5247\u5c08\u6ce8\u65bc\u8b80\u53d6\u64cd\u4f5c\u3002\u9019\u6a23\u7684\u67b6\u69cb\u53ef\u4ee5\u6709\u6548\u5730\u6e1b\u5c11\u4e3b\u6578\u64da\u5eab\u7684\u8ca0\u64d4\uff0c\u63d0\u9ad8\u6574\u9ad4\u7cfb\u7d71\u7684\u6027\u80fd\u548c\u97ff\u61c9\u901f\u5ea6\u3002<\/p>\n<h2 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e8%ae%80%e5%af%ab%e5%88%86%e9%9b%a2%e4%b8%ad%e9%96%93%e4%bb%b6%e7%9a%84%e4%bd%9c%e7%94%a8-pmpnJEGLzg\">\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\u7684\u4f5c\u7528<\/h2>\n<p>\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\u7684\u4e3b\u8981\u4f5c\u7528\u662f\u7ba1\u7406\u6578\u64da\u5eab\u7684\u8b80\u5beb\u8acb\u6c42\uff0c\u6839\u64da\u8acb\u6c42\u7684\u985e\u578b\u5c07\u5176\u8def\u7531\u5230\u76f8\u61c9\u7684\u4e3b\u5f9e\u6578\u64da\u5eab\u3002\u9019\u4e0d\u50c5\u63d0\u9ad8\u4e86\u6578\u64da\u5eab\u7684\u6027\u80fd\uff0c\u9084\u589e\u5f37\u4e86\u7cfb\u7d71\u7684\u53ef\u7528\u6027\u548c\u5bb9\u932f\u80fd\u529b\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\uff1a<\/p>\n<h3 id=\"1-mycat-pmpnJEGLzg\">1. Mycat<\/h3>\n<p>Mycat \u662f\u4e00\u6b3e\u958b\u6e90\u7684\u6578\u64da\u5eab\u4e2d\u9593\u4ef6\uff0c\u652f\u6301 MySQL \u548c Oracle \u7b49\u591a\u7a2e\u6578\u64da\u5eab\u3002\u5b83\u63d0\u4f9b\u4e86\u9748\u6d3b\u7684\u8b80\u5beb\u5206\u96e2\u529f\u80fd\uff0c\u4e26\u4e14\u652f\u6301\u591a\u7a2e\u8def\u7531\u7b56\u7565\u3002Mycat \u7684\u914d\u7f6e\u76f8\u5c0d\u7c21\u55ae\uff0c\u9069\u5408\u4e2d\u5c0f\u578b\u4f01\u696d\u4f7f\u7528\u3002<\/p>\n<pre><code>\n# Mycat \u914d\u7f6e\u793a\u4f8b\n\n    \n        \u4e3b\u6578\u64da\u5eab\n    \n    \n        \u5f9e\u6578\u64da\u5eab1\n        \u5f9e\u6578\u64da\u5eab2\n    \n\n<\/code><\/pre>\n<h3 id=\"2-shardingsphere-pmpnJEGLzg\">2. ShardingSphere<\/h3>\n<p>ShardingSphere \u662f\u4e00\u500b\u5206\u5e03\u5f0f\u6578\u64da\u5eab\u4e2d\u9593\u4ef6\uff0c\u652f\u6301\u6578\u64da\u5206\u7247\u548c\u8b80\u5beb\u5206\u96e2\u3002\u5b83\u63d0\u4f9b\u4e86\u9748\u6d3b\u7684\u914d\u7f6e\u9078\u9805\uff0c\u4e26\u4e14\u53ef\u4ee5\u8207\u591a\u7a2e\u6578\u64da\u5eab\u7cfb\u7d71\u96c6\u6210\u3002ShardingSphere \u7684\u512a\u52e2\u5728\u65bc\u5176\u5f37\u5927\u7684\u64f4\u5c55\u6027\u548c\u793e\u5340\u652f\u6301\u3002<\/p>\n<pre><code>\n# ShardingSphere \u914d\u7f6e\u793a\u4f8b\ndataSources:\n  ds0:\n    type: Hikari\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    jdbc-url: jdbc:mysql:\/\/localhost:3306\/db0\n    username: root\n    password: root\n  ds1:\n    type: Hikari\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    jdbc-url: jdbc:mysql:\/\/localhost:3306\/db1\n    username: root\n    password: root\nrules:\n  - !READWRITE_SPLITTING\n    dataSources:\n      writeDataSourceName: ds0\n      readDataSourceNames: ds1\n<\/code><\/pre>\n<h3 id=\"3-atlas-pmpnJEGLzg\">3. Atlas<\/h3>\n<p>Atlas \u662f\u4e00\u6b3e\u7531\u963f\u91cc\u5df4\u5df4\u958b\u767c\u7684\u6578\u64da\u5eab\u4e2d\u9593\u4ef6\uff0c\u5c08\u6ce8\u65bc\u8b80\u5beb\u5206\u96e2\u548c\u6578\u64da\u5eab\u7684\u9ad8\u53ef\u7528\u6027\u3002\u5b83\u652f\u6301\u591a\u7a2e\u6578\u64da\u5eab\u985e\u578b\uff0c\u4e26\u4e14\u63d0\u4f9b\u4e86\u8c50\u5bcc\u7684\u76e3\u63a7\u548c\u7ba1\u7406\u529f\u80fd\u3002Atlas \u7684\u512a\u52e2\u5728\u65bc\u5176\u9ad8\u6027\u80fd\u548c\u7a69\u5b9a\u6027\uff0c\u9069\u5408\u5927\u578b\u4f01\u696d\u4f7f\u7528\u3002<\/p>\n<h2 id=\"%e9%81%b8%e6%93%87%e5%90%88%e9%81%a9%e7%9a%84%e4%b8%ad%e9%96%93%e4%bb%b6-pmpnJEGLzg\">\u9078\u64c7\u5408\u9069\u7684\u4e2d\u9593\u4ef6<\/h2>\n<p>\u5728\u9078\u64c7\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\u6642\uff0c\u4f01\u696d\u61c9\u8003\u616e\u4ee5\u4e0b\u5e7e\u500b\u56e0\u7d20\uff1a<\/p>\n<ul>\n<li><strong>\u6027\u80fd\u9700\u6c42\uff1a<\/strong>\u6839\u64da\u696d\u52d9\u7684\u5be6\u969b\u9700\u6c42\u9078\u64c7\u5408\u9069\u7684\u4e2d\u9593\u4ef6\uff0c\u78ba\u4fdd\u5176\u80fd\u5920\u6eff\u8db3\u9ad8\u4e26\u767c\u7684\u8b80\u5beb\u8acb\u6c42\u3002<\/li>\n<li><strong>\u64f4\u5c55\u6027\uff1a<\/strong>\u9078\u64c7\u652f\u6301\u6578\u64da\u5eab\u64f4\u5c55\u7684\u4e2d\u9593\u4ef6\uff0c\u4ee5\u4fbf\u672a\u4f86\u80fd\u5920\u8f15\u9b06\u5730\u589e\u52a0\u66f4\u591a\u7684\u6578\u64da\u5eab\u5be6\u4f8b\u3002<\/li>\n<li><strong>\u793e\u5340\u652f\u6301\uff1a<\/strong>\u9078\u64c7\u64c1\u6709\u6d3b\u8e8d\u793e\u5340\u548c\u826f\u597d\u6587\u6a94\u7684\u4e2d\u9593\u4ef6\uff0c\u4ee5\u4fbf\u5728\u9047\u5230\u554f\u984c\u6642\u80fd\u5920\u7372\u5f97\u53ca\u6642\u7684\u5e6b\u52a9\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-pmpnJEGLzg\">\u7e3d\u7d50<\/h2>\n<p>\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\u5728\u63d0\u5347\u7cfb\u7d71\u6027\u80fd\u548c\u53ef\u7528\u6027\u65b9\u9762\u767c\u63ee\u4e86\u91cd\u8981\u4f5c\u7528\u3002\u9078\u64c7\u5408\u9069\u7684\u4e2d\u9593\u4ef6\u53ef\u4ee5\u5e6b\u52a9\u4f01\u696d\u66f4\u597d\u5730\u61c9\u5c0d\u65e5\u76ca\u589e\u9577\u7684\u6578\u64da\u9700\u6c42\u3002\u7121\u8ad6\u662f Mycat\u3001ShardingSphere \u9084\u662f Atlas\uff0c\u5404\u6709\u5176\u7279\u9ede\u548c\u512a\u52e2\uff0c\u4f01\u696d\u61c9\u6839\u64da\u81ea\u8eab\u9700\u6c42\u9032\u884c\u9078\u64c7\u3002\u5c0d\u65bc\u9700\u8981\u9ad8\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u7684\u4f01\u696d\uff0c\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\u4f86\u642d\u5efa\u6578\u64da\u5eab\u74b0\u5883\uff0c\u5c07\u6709\u52a9\u65bc\u63d0\u5347\u6574\u9ad4\u7cfb\u7d71\u7684\u6548\u7387\u548c\u53ef\u9760\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22\u6578\u64da\u5eab\u8b80\u5beb\u5206\u96e2\u4e2d\u9593\u4ef6\u7684\u63a8\u85a6\u5f59\u7e3d\uff0c\u4e86\u89e3\u5404\u7a2e\u4e2d\u9593\u4ef6\u7684\u7279\u9ede\u8207\u512a\u52e2\uff0c\u52a9\u529b\u63d0\u5347\u6578\u64da\u5eab\u6027\u80fd\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-186460","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186460","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=186460"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186460\/revisions"}],"predecessor-version":[{"id":186461,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186460\/revisions\/186461"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=186460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=186460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=186460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}