{"id":117681,"date":"2026-10-25T05:56:42","date_gmt":"2026-10-24T21:56:42","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/117681.html"},"modified":"2026-10-25T05:56:42","modified_gmt":"2026-10-24T21:56:42","slug":"mysql%e4%b9%8b%e8%af%bb%e5%86%99%e5%88%86%e7%a6%bb%e4%b8%8e%e5%88%86%e5%ba%93%e5%88%86%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/117681.html","title":{"rendered":"MySQL\u4e4b\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868"},"content":{"rendered":"<p style=\"text-align:center\">\u00a0\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"bksczm\" height=\"150\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261024215637-6add2995135fb.png\" width=\"150\" \/><\/p>\n<p style=\"text-align:center\">\n<p style=\"text-align:center\">&#x1f4da; \u672c\u6587\u6536\u5f55\u4e8e\u300cbksczm\u300d\u7684\u7cfb\u5217\u4e13\u680f<\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" alt=\"Linux\" height=\"32\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261024215637-6add29958b98d.png\" width=\"32\" \/>Linux<\/td>\n<td style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" alt=\"C\/C++\" height=\"32\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261024215637-6add299596746.jpg\" width=\"32\" \/>C\/C&#043;&#043;<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" alt=\"MySQL\" height=\"32\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261024215638-6add2996815be.jpg\" width=\"32\" \/>MySQL<\/td>\n<td style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\u9762\u8bd5\u9898\" height=\"32\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261024215639-6add29976c875.jpg\" width=\"32\" \/>\u9762\u8bd5\u9898<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" alt=\"Redis\" height=\"32\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261024215640-6add299859e96.jpg\" width=\"32\" \/>Redis<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4e00\u3001ShardingSphere \u5b9a\u4f4d<\/h3>\n<p>ShardingSphere-Proxy \u5bf9\u5e94\u7528\u5c42\u4f2a\u88c5\u6210\u4e00\u4e2a MySQL \u670d\u52a1&#xff08;\u9ed8\u8ba4\u7aef\u53e3 3307&#xff09;\u3002\u5e94\u7528\u628a\u5b83\u5f53\u6210\u4e00\u4e2a\u666e\u901a MySQL \u8fde\u63a5&#xff0c;SQL \u5168\u90e8\u53d1\u7ed9\u5b83&#xff0c;\u7531\u5b83\u8d1f\u8d23&#xff1a;<\/p>\n<ul>\n<li>\u8bfb\u5199\u5206\u79bb\u8def\u7531&#xff1a;\u5199\u8d70\u4e3b\u5e93\u3001\u8bfb\u8d70\u4ece\u5e93&#xff1b;<\/li>\n<li>\u5206\u7247\u8def\u7531&#xff1a;\u6309\u5206\u7247\u7b97\u6cd5\u628a SQL \u8def\u7531\u5230\u771f\u5b9e\u7684\u5e93\/\u8868&#xff1b;<\/li>\n<li>\u7ed3\u679c\u5f52\u5e76\u3001\u5206\u5e03\u5f0f\u4e3b\u952e\u751f\u6210\u3001\u5206\u5e03\u5f0f\u4e8b\u52a1\u534f\u8c03\u3002<\/li>\n<\/ul>\n<p>\u5b83\u7684\u89d2\u8272\u548c\u4e4b\u524d\u8bb2\u7684&#034;\u7f51\u5173\u670d\u52a1\u5668&#034;\u4e00\u81f4&#xff1a;\u4e00\u4e2a\u65e0\u72b6\u6001\u7684 SQL \u8def\u7531\/\u8d1f\u8f7d\u5747\u8861\u5c42\u3002<\/p>\n<p>\u5b89\u88c5\u53c2\u8003&#xff1a;Shardingsphere\u5b89\u88c5-CSDN\u535a\u5ba2<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"502\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261024215641-6add299944bb9.png\" width=\"761\" \/><\/p>\n<hr \/>\n<h2>\u4e8c\u3001\u8bfb\u5199\u5206\u79bb<\/h2>\n<h3>2.1 \u8bfb\u5199\u5206\u79bb\u7684\u601d\u60f3<\/h3>\n<ul>\n<li>\u4e3b\u5e93&#xff08;Master&#xff09;&#xff1a;\u5904\u7406\u6240\u6709\u5199\u64cd\u4f5c&#xff08;INSERT\/UPDATE\/DELETE\/DDL&#xff09;&#xff1b;<\/li>\n<li>\u4ece\u5e93&#xff08;Slave&#xff09;&#xff1a;\u5904\u7406\u8bfb\u64cd\u4f5c&#xff08;SELECT&#xff09;&#xff0c;\u591a\u4e2a\u4ece\u5e93\u5206\u62c5\u8bfb\u538b\u529b&#xff1b;<\/li>\n<li>\u4e2d\u95f4\u901a\u8fc7 binlog relaylog \u4e3b\u4ece\u590d\u5236\u4fdd\u8bc1\u6570\u636e\u540c\u6b65\u3002<\/li>\n<\/ul>\n<p>ShardingSphere \u8d1f\u8d23\u628a SQL \u6309\u7c7b\u578b\u5206\u6d41&#xff0c;\u5e94\u7528\u65e0\u9700\u5173\u5fc3\u4e3b\u4ece\u5730\u5740\u3002<\/p>\n<h3>2.2 \u914d\u7f6e\u6587\u4ef6 config-readwrite-splitting.yaml&#xff08;\u9010\u884c\u6ce8\u91ca&#xff09;<\/h3>\n<p> # \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br \/>\n# \u903b\u8f91\u6570\u636e\u5e93\u540d&#xff1a;\u5e94\u7528\u8fde\u63a5 Proxy \u540e USE \u7684\u5e93\u540d&#xff0c;\u7531 Proxy \u865a\u62df\u51fa\u6765<br \/>\n# \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br \/>\ndatabaseName: readwrite_splitting_db<\/p>\n<p># \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br \/>\n# dataSources&#xff1a;\u58f0\u660e\u6240\u6709\u300c\u771f\u5b9e MySQL \u5b9e\u4f8b\u300d\u7684\u8fde\u63a5\u6c60<br \/>\n# \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br \/>\ndataSources:<br \/>\n  write_ds:                                          # \u81ea\u5b9a\u4e49\u6570\u636e\u6e90\u540d&#xff08;\u4e3b\u5e93\/\u5199\u5e93&#xff09;<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:3306\/test_db?        # JDBC \u5730\u5740&#xff1a;\u534f\u8bae:\/\/IP:\u7aef\u53e3\/\u5e93\u540d<br \/>\n         characterEncoding&#061;utf8&amp;                     # \u8fde\u63a5\u5b57\u7b26\u7f16\u7801<br \/>\n         serverTimezone&#061;Asia\/Shanghai&amp;               # \u65f6\u533a<br \/>\n         allowPublicKeyRetrieval&#061;true&amp;               # 8.0 \u5141\u8bb8\u83b7\u53d6\u516c\u94a5<br \/>\n         useSSL&#061;false                                # \u5185\u7f51\u5173\u95ed SSL<br \/>\n    username: root                                   # \u8fde\u63a5\u7528\u6237\u540d<br \/>\n    password: &#039;xxxxxxxxxxxxxx&#039;                       # \u5bc6\u7801&#xff08;\u542b &#064;\u3001. \u7b49\u7279\u6b8a\u5b57\u7b26\u5fc5\u987b\u52a0\u5f15\u53f7&#xff09;<br \/>\n    connectionTimeoutMilliseconds: 30000             # \u5efa\u7acb\u8fde\u63a5\u8d85\u65f6&#xff08;\u6beb\u79d2&#xff09;<br \/>\n    idleTimeoutMilliseconds: 60000                   # \u7a7a\u95f2\u8fde\u63a5\u56de\u6536\u65f6\u95f4&#xff08;\u6beb\u79d2&#xff09;<br \/>\n    maxLifetimeMilliseconds: 1800000                 # \u8fde\u63a5\u6700\u5927\u5b58\u6d3b\u65f6\u95f4&#xff08;30 \u5206\u949f&#xff09;<br \/>\n    maxPoolSize: 50                                  # \u8fde\u63a5\u6c60\u6700\u5927\u8fde\u63a5\u6570<br \/>\n    minPoolSize: 1                                   # \u8fde\u63a5\u6c60\u6700\u5c0f\u7a7a\u95f2\u8fde\u63a5\u6570<br \/>\n  read_ds_0:                                         # \u4ece\u5e93 1&#xff08;\u5bb9\u5668\u6620\u5c04\u7aef\u53e3 53307&#xff09;<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:53307\/test_db?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;allowPublicKeyRetrieval&#061;true&amp;useSSL&#061;false<br \/>\n    username: backup<br \/>\n    password: 123456<br \/>\n    connectionTimeoutMilliseconds: 30000<br \/>\n    idleTimeoutMilliseconds: 60000<br \/>\n    maxLifetimeMilliseconds: 1800000<br \/>\n    maxPoolSize: 50<br \/>\n    minPoolSize: 1<br \/>\n  read_ds_1:                                         # \u4ece\u5e93 2&#xff08;\u5bb9\u5668\u6620\u5c04\u7aef\u53e3 53308&#xff0c;\u4e0d\u80fd\u4e0e\u4ece\u5e931\u91cd\u590d&#xff09;<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:53308\/test_db?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;allowPublicKeyRetrieval&#061;true&amp;useSSL&#061;false<br \/>\n    username: backup<br \/>\n    password: 123456<br \/>\n    connectionTimeoutMilliseconds: 30000<br \/>\n    idleTimeoutMilliseconds: 60000<br \/>\n    maxLifetimeMilliseconds: 1800000<br \/>\n    maxPoolSize: 50<br \/>\n    minPoolSize: 1<\/p>\n<p># \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br \/>\n# rules&#xff1a;\u89c4\u5219\u533a&#xff08;\u8bfb\u5199\u5206\u79bb\u3001\u5206\u7247\u3001\u52a0\u5bc6\u7b49\u53ef\u53e0\u52a0&#xff09;<br \/>\n# \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br \/>\nrules:<br \/>\n  &#8211; !READWRITE_SPLITTING                             # \u58f0\u660e&#xff1a;\u8bfb\u5199\u5206\u79bb\u89c4\u5219<br \/>\n    dataSources:<br \/>\n      readwrite_ds:                                  # \u903b\u8f91\u8bfb\u5199\u5206\u79bb\u6570\u636e\u6e90\u540d&#xff08;\u5bf9\u5916\u5f15\u7528&#xff09;<br \/>\n        staticStrategy:                              # \u9759\u6001\u7b56\u7565&#xff1a;\u4e3b\u4ece\u89d2\u8272\u56fa\u5b9a<br \/>\n          writeDataSourceName: write_ds              # \u5199\u8bf7\u6c42 \u2192 write_ds<br \/>\n          readDataSourceNames:                       # \u8bfb\u8bf7\u6c42 \u2192 \u4ece\u4e0b\u9762\u5217\u8868\u4e2d\u9009<br \/>\n            &#8211; read_ds_0<br \/>\n            &#8211; read_ds_1<br \/>\n          loadBalancerName: random                   # \u5f15\u7528\u8d1f\u8f7d\u5747\u8861\u7b97\u6cd5<br \/>\n    loadBalancers:                                   # \u8d1f\u8f7d\u5747\u8861\u7b97\u6cd5\u5b9a\u4e49\u533a<br \/>\n      random:                                        # \u7b97\u6cd5\u540d&#xff08;\u4e0e\u4e0a\u9762\u5bf9\u5e94&#xff09;<br \/>\n        type: RANDOM<br \/>\n    # \u7c7b\u578b&#xff1a;RANDOM \/ ROUND_ROBIN \/ WEIGHT<\/p>\n<p>\u26a0\ufe0f YAML \u683c\u5f0f\u7ea2\u7ebf&#xff1a;<span style=\"color:#fe2c24\">\u5168\u90e8\u7528\u7a7a\u683c\u7f29\u8fdb<\/span>&#xff0c;\u7981\u6b62 Tab&#xff1b;\u6bcf\u5c42 2 \u4e2a\u7a7a\u683c&#xff1b;\u5192\u53f7\u540e\u9762\u5fc5\u987b\u6709\u4e00\u4e2a\u7a7a\u683c\u3002\u5185\u5bb9\u4e00\u6837\u5374\u62a5\u9519\u65f6&#xff0c;\u5341\u6709\u516b\u4e5d\u662f\u683c\u5f0f\u95ee\u9898&#xff0c;\u5efa\u8bae\u624b\u6572\u4e00\u904d\u3002<\/p>\n<h4>JDBC URL \u5404\u6bb5\u542b\u4e49<\/h4>\n<p> jdbc:mysql:\/\/127.0.0.1:3306\/test_db?characterEncoding&#061;utf8&amp;serverTimezone&#061;&#8230;<br \/>\n\u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u252c\u2500\u2518 \u2514\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n \u534f\u8bae      \u5b50\u534f\u8bae      \u4e3b\u673aIP    \u7aef\u53e3   \u5e93\u540d           \u8fde\u63a5\u53c2\u6570<\/p>\n<ul>\n<li>jdbc:mysql&#xff1a;\u4f7f\u7528 JDBC \u534f\u8bae\u8fde\u63a5 MySQL&#xff1b;<\/li>\n<li>127.0.0.1&#xff1a;\u672c\u673a\u56de\u73af\u5730\u5740&#xff08;\u4e0d\u662f\u516c\u7f51 IP&#xff09;&#xff0c;\u8de8\u4e3b\u673a\u8fde\u63a5\u65f6\u586b\u771f\u5b9e IP&#xff1b;<\/li>\n<li>? \u540e\u9762\u662f\u8fde\u63a5\u53c2\u6570&#xff08;\u5b57\u7b26\u96c6\u3001\u65f6\u533a\u3001SSL \u7b49&#xff09;\u3002<\/li>\n<\/ul>\n<h3>2.3 \u8d1f\u8f7d\u5747\u8861\u7b97\u6cd5<\/h3>\n<table>\n<tr>\u7b97\u6cd5\u542b\u4e49\u9002\u7528<\/tr>\n<tbody>\n<tr>\n<td>ROUND_ROBIN<\/td>\n<td>\u8f6e\u8be2&#xff0c;\u8bfb\u8bf7\u6c42\u4f9d\u6b21\u5206\u7ed9\u5404\u4ece\u5e93<\/td>\n<td>\u673a\u5668\u6027\u80fd\u76f8\u540c&#xff0c;\u6700\u5e38\u7528<\/td>\n<\/tr>\n<tr>\n<td>RANDOM<\/td>\n<td>\u968f\u673a<\/td>\n<td>\u914d\u7f6e\u7b80\u5355<\/td>\n<\/tr>\n<tr>\n<td>WEIGHT<\/td>\n<td>\u6309\u6743\u91cd\u6bd4\u4f8b\u5206\u53d1<\/td>\n<td>\u4ece\u5e93\u6027\u80fd\u4e0d\u540c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>WEIGHT \u914d\u7f6e\u793a\u4f8b&#xff1a;<\/p>\n<p>     loadBalancers:<br \/>\n      weight:<br \/>\n        type: WEIGHT<br \/>\n        props:<br \/>\n          read_ds_0: 2.0<br \/>\n          read_ds_1: 1.0<\/p>\n<p>\u8868\u793a\u603b\u4f53\u4e0a\u6309 2:1 \u5206\u914d&#xff08;\u4e0d\u662f&#034;\u5148\u7ed9 0 \u53d1\u4e24\u6761\u3001\u518d\u7ed9 1 \u53d1\u4e00\u6761&#034;&#xff09;\u3002<\/p>\n<h3>2.4 \u8fde\u63a5\u4e0e\u6d4b\u8bd5<\/h3>\n<p> # \u8fde\u63a5 ShardingSphere-Proxy&#xff08;\u6ce8\u610f\u662f 3307&#xff0c;\u4e0d\u662f 3306&#xff1b;-h \u5c0f\u5199&#xff09;<br \/>\nmysql -h 127.0.0.1 -P 3307 -uroot -p<\/p>\n<p>\u53e6\u5f00\u4e00\u4e2a\u7ec8\u7aef\u76d1\u63a7\u65e5\u5fd7&#xff1a;<\/p>\n<p> tail -f logs\/stdout.log<\/p>\n<p>\u9a8c\u8bc1&#xff1a;<\/p>\n<ul>\n<li>\u6267\u884c INSERT&#xff0c;\u65e5\u5fd7\u663e\u793a\u8def\u7531\u5230 write_ds&#xff08;\u4e3b\u5e93&#xff09;&#xff1b;<\/li>\n<li>\u6267\u884c SELECT&#xff0c;\u65e5\u5fd7\u663e\u793a\u8def\u7531\u5230\u67d0\u4e2a read_ds&#xff08;\u4ece\u5e93&#xff09;\u3002<\/li>\n<\/ul>\n<h3>2.5 <span style=\"color:#fe2c24\">\u4e3b\u4ece\u5ef6\u8fdf\u95ee\u9898<\/span><\/h3>\n<p>\u5f02\u6b65\u590d\u5236\u4e0b&#xff0c;\u521a\u5199\u5165\u4e3b\u5e93\u7684\u6570\u636e\u53ef\u80fd\u8fd8\u6ca1\u540c\u6b65\u5230\u4ece\u5e93&#xff0c;\u6b64\u65f6\u8bfb\u4ece\u5e93\u4f1a\u8bfb\u5230\u65e7\u6570\u636e\u3002\u5904\u7406\u7b56\u7565&#xff1a;<\/p>\n<ul>\n<li>\u5199\u540e\u7acb\u5373\u8bfb\u7684\u5f3a\u4e00\u81f4\u573a\u666f&#xff08;\u652f\u4ed8\u540e\u8df3\u8ba2\u5355\u9875&#xff09;\u5f3a\u5236\u8d70\u4e3b\u5e93&#xff1b;<\/li>\n<li>\u5f00\u542f\u534a\u540c\u6b65\u590d\u5236\u7f29\u77ed\u5ef6\u8fdf&#xff1b;<\/li>\n<li>\u76d1\u63a7\u4ece\u5e93\u5ef6\u8fdf&#xff0c;\u5ef6\u8fdf\u8fc7\u5927\u65f6\u6458\u9664\u8be5\u4ece\u5e93\u3002<\/li>\n<\/ul>\n<hr \/>\n<h2>\u4e09\u3001\u5206\u5e93\u5206\u8868\u6838\u5fc3\u6982\u5ff5<\/h2>\n<p>ShardingSphere \u628a\u5206\u5e93\u5206\u8868\u7edf\u79f0\u4e3a\u5206\u7247&#xff08;Sharding&#xff09;\u3002<\/p>\n<h3>3.1 \u5782\u76f4\u5206\u5e93<\/h3>\n<p>\u4e00\u4e2a\u5e93\u91cc\u8868\u592a\u591a\u3001\u4e1a\u52a1\u592a\u6742&#xff0c;\u6309\u4e1a\u52a1\u5173\u8054\u6027\u62c6\u5e93&#xff0c;\u90e8\u7f72\u5230\u4e0d\u540c\u670d\u52a1\u5668&#xff1a;<\/p>\n<ul>\n<li>\u4f8b&#xff1a;\u7528\u6237\u5e93 db_user\u3001\u8ba2\u5355\u5e93 db_order\u3001\u5546\u54c1\u5e93 db_goods&#xff1b;<\/li>\n<li>\u6548\u679c&#xff1a;\u65e2\u7f13\u89e3\u538b\u529b&#xff0c;\u53c8\u771f\u6b63\u6269\u5bb9&#xff08;\u4e0d\u540c\u670d\u52a1\u5668&#xff09;\u3002<\/li>\n<\/ul>\n<h3>3.2 \u5782\u76f4\u5206\u8868<\/h3>\n<p>\u4e00\u4e2a\u8868\u5b57\u6bb5\u592a\u591a\u3001\u5b58\u5728\u5927\u5b57\u6bb5&#xff08;\u5982\u5546\u54c1\u63cf\u8ff0 TEXT&#xff09;&#xff0c;\u628a\u4e0d\u5e38\u7528\u5927\u5b57\u6bb5\u62c6\u6210 1:1 \u6269\u5c55\u8868&#xff1a;<\/p>\n<ul>\n<li>t_goods(id, name, price) \u4e0e t_goods_desc(goods_id, description)&#xff1b;<\/li>\n<li>\u901a\u8fc7\u4e3b\u952e goods_id \u5bf9\u5e94&#xff1b;<\/li>\n<li>\u6548\u679c&#xff1a;\u4e3b\u8868\u884c\u53d8\u5c0f\u3001B&#043; \u6811\u66f4\u77ee\u3001\u5355\u9875\u80fd\u653e\u66f4\u591a\u884c&#xff1b;\u4f46\u4ecd\u5728\u540c\u4e00\u670d\u52a1\u5668&#xff0c;\u4e0d\u6269\u5bb9\u3002<\/li>\n<\/ul>\n<h3>3.3 \u6c34\u5e73\u5206\u8868<\/h3>\n<p>\u8868\u884c\u6570\u592a\u591a&#xff0c;\u6309\u5206\u7247\u952e &#043; \u7b97\u6cd5\u628a\u6570\u636e\u884c\u62c6\u5230\u591a\u5f20\u7ed3\u6784\u76f8\u540c\u7684\u8868&#xff1a;<\/p>\n<ul>\n<li>\u4f8b&#xff1a;user_id % 2 &#061; 0 \u8fdb goods_0&#xff0c;&#061; 1 \u8fdb goods_1&#xff1b;<\/li>\n<li>\u4ecd\u5728\u540c\u4e00\u670d\u52a1\u5668&#xff0c;\u4e0d\u6269\u5bb9&#xff0c;\u89e3\u51b3\u5355\u8868\u884c\u6570\u8fc7\u591a\u3002<\/li>\n<\/ul>\n<h3>3.4 \u6c34\u5e73\u5206\u5e93<\/h3>\n<p>\u628a\u6570\u636e\u884c\u62c6\u5230\u4e0d\u540c\u670d\u52a1\u5668\u4e0a\u7684\u540c\u540d\u5e93&#xff1a;<\/p>\n<ul>\n<li>\u4f8b&#xff1a;goods_0 \u5728\u673a\u5668 A&#xff0c;goods_1 \u5728\u673a\u5668 B&#xff1b;<\/li>\n<li>\u6548\u679c&#xff1a;\u6027\u80fd\u4e0e\u5bb9\u91cf\u53cc\u63d0\u5347\u3002<\/li>\n<\/ul>\n<h3>3.5 \u56db\u79cd\u65b9\u5f0f\u5bf9\u6bd4<\/h3>\n<table>\n<tr>\u65b9\u5f0f\u62c6\u5206\u5bf9\u8c61\u662f\u5426\u6269\u5bb9\u89e3\u51b3\u95ee\u9898<\/tr>\n<tbody>\n<tr>\n<td>\u5782\u76f4\u5206\u5e93<\/td>\n<td>\u6309\u4e1a\u52a1\u62c6\u5e93<\/td>\n<td>\u662f<\/td>\n<td>\u4e1a\u52a1\u8026\u5408\u3001\u6574\u4f53\u538b\u529b<\/td>\n<\/tr>\n<tr>\n<td>\u5782\u76f4\u5206\u8868<\/td>\n<td>\u62c6\u5b57\u6bb5<\/td>\n<td>\u5426<\/td>\n<td>\u5927\u5b57\u6bb5\u3001\u884c\u8fc7\u5927<\/td>\n<\/tr>\n<tr>\n<td>\u6c34\u5e73\u5206\u8868<\/td>\n<td>\u62c6\u6570\u636e\u884c<\/td>\n<td>\u5426<\/td>\n<td>\u5355\u8868\u884c\u6570\u8fc7\u591a<\/td>\n<\/tr>\n<tr>\n<td>\u6c34\u5e73\u5206\u5e93<\/td>\n<td>\u62c6\u6570\u636e\u884c\u5230\u4e0d\u540c\u673a\u5668<\/td>\n<td>\u662f<\/td>\n<td>\u5355\u8868\u5927 &#043; \u5bb9\u91cf<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5206\u5e93\u57fa\u672c\u9488\u5bf9\u670d\u52a1\u5668\u5c42\u9762&#xff1b;\u5206\u8868\u5e38\u5728\u5355\u670d\u52a1\u5668\u5185\u64cd\u4f5c\u3002<\/p>\n<hr \/>\n<h2>\u56db\u3001\u5782\u76f4\u5206\u5e93\u914d\u7f6e<\/h2>\n<p>config-sharding.yaml&#xff1a;<\/p>\n<p> databaseName: sharding_db<\/p>\n<p>dataSources:<br \/>\n  server_user:<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:3306\/test_db_id?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;useSSL&#061;false<br \/>\n    username: root<br \/>\n    password: &#039;&#064;Czm388512369.&#039;<br \/>\n    connectionTimeoutMilliseconds: 30000<br \/>\n    idleTimeoutMilliseconds: 60000<br \/>\n    maxLifetimeMilliseconds: 1800000<br \/>\n    maxPoolSize: 50<br \/>\n    minPoolSize: 1<br \/>\n  server_order:<br \/>\n    url: jdbc:mysql:\/\/192.168.80.138:53311\/test_db_desc?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;useSSL&#061;false<br \/>\n    username: backup<br \/>\n    password: 123456<br \/>\n    connectionTimeoutMilliseconds: 30000<br \/>\n    idleTimeoutMilliseconds: 60000<br \/>\n    maxLifetimeMilliseconds: 1800000<br \/>\n    maxPoolSize: 50<br \/>\n    minPoolSize: 1<\/p>\n<p>rules:<br \/>\n  &#8211; !SHARDING<br \/>\n    tables:<br \/>\n      user:                                        # \u903b\u8f91\u8868\u540d\u79f0(\u81ea\u5b9a\u4e49)<br \/>\n        actualDataNodes: server_user.t_user        # \u6570\u636e\u6e90\u540d.\u771f\u5b9e\u8868\u540d<br \/>\n      order:<br \/>\n        actualDataNodes: server_order.t_order<\/p>\n<ul>\n<li>actualDataNodes&#xff1a;\u6570\u636e\u6e90\u540d.\u771f\u5b9e\u8868\u540d&#xff0c;\u6307\u5b9a\u903b\u8f91\u8868\u6570\u636e\u843d\u5728\u54ea\u4e2a\u771f\u5b9e\u8282\u70b9&#xff1b;<\/li>\n<li>\u8fde\u63a5\u903b\u8f91\u5e93 USE sharding_db \u540e&#xff0c;\u5bf9 user \u7684 SQL \u8def\u7531\u5230\u7528\u6237\u5e93&#xff0c;\u5bf9 order \u7684 SQL \u8def\u7531\u5230\u8ba2\u5355\u5e93\u3002<\/li>\n<\/ul>\n<p><span style=\"color:#fe2c24\">\u53ea\u5728\u8bfb\u5199\u5206\u79bb\u6587\u4ef6\u91cc\u914d\u591a\u4e2a\u5199\u5e93\u4e5f\u80fd&#034;\u95f4\u63a5&#034;\u5b9e\u73b0\u5782\u76f4\u5206\u5e93&#xff0c;\u53c2\u8003\u9644\u5f55&#xff01;&#xff01;&#xff01;<\/span>&#xff0c;\u4f46 SHARDING \u89c4\u5219\u63d0\u4f9b\u4e86\u81ea\u52a8\u8def\u7531\u3001\u5206\u7247\u7b97\u6cd5\u3001\u7ed1\u5b9a\u8868\u3001\u4e3b\u952e\u751f\u6210\u7b49\u5b8c\u6574\u80fd\u529b&#xff0c;\u751f\u4ea7\u5e94\u5728\u5206\u7247\u89c4\u5219\u4e2d\u505a&#xff08;\u6216\u4e24\u6761\u89c4\u5219\u53e0\u52a0&#xff0c;\u89c1\u7b2c\u4e5d\u7ae0&#xff09;\u3002<\/p>\n<hr \/>\n<h2>\u4e94\u3001\u6c34\u5e73\u5206\u7247\u914d\u7f6e&#xff08;\u5305\u62ecbind\u3001broadcast\u3001keygenerator&#xff09;<\/h2>\n<p>\u5047\u8bbe&#xff1a;\u5148\u6309 user_id \u5206\u5e93&#xff08;2 \u4e2a\u5e93&#xff09;&#xff0c;\u518d\u6309 goods_id \u5206\u8868&#xff08;\u6bcf\u4e2a\u5e93 2 \u5f20\u8868&#xff09;&#xff0c;\u5171 4 \u4e2a\u771f\u5b9e\u8282\u70b9\u3002<\/p>\n<h3>5.1 \u5efa\u771f\u5b9e\u8868<\/h3>\n<p> &#8212; \u5b9e\u4f8b0&#xff08;test_db_id0&#xff09;<br \/>\nCREATE DATABASE IF NOT EXISTS test_db_id0;<br \/>\nUSE test_db_id0;<br \/>\nCREATE TABLE IF NOT EXISTS goods_id_gd0 (id INT PRIMARY KEY, user_id INT NOT NULL, goods_id VARCHAR(20) NOT NULL);<br \/>\nCREATE TABLE IF NOT EXISTS goods_id_gd1 (id INT PRIMARY KEY, user_id INT NOT NULL, goods_id VARCHAR(20) NOT NULL);<\/p>\n<p>&#8212; \u5b9e\u4f8b1&#xff08;test_db_id1&#xff09;<br \/>\nCREATE DATABASE IF NOT EXISTS test_db_id1;<br \/>\nUSE test_db_id1;<br \/>\nCREATE TABLE IF NOT EXISTS goods_id_gd0 (id INT PRIMARY KEY, user_id INT NOT NULL, goods_id VARCHAR(20) NOT NULL);<br \/>\nCREATE TABLE IF NOT EXISTS goods_id_gd1 (id INT PRIMARY KEY, user_id INT NOT NULL, goods_id VARCHAR(20) NOT NULL);<\/p>\n<h3>5.2 \u5b8c\u6574\u914d\u7f6e\u4e0e\u9010\u884c\u6ce8\u91ca<\/h3>\n<p> databaseName: sharding_db                            # \u903b\u8f91\u5e93\u540d<\/p>\n<p>dataSources:<br \/>\n  server_user0:                                      # \u7269\u7406\u6570\u636e\u6e90 0<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:3306\/test_db_id0?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;useSSL&#061;false<br \/>\n    username: root<br \/>\n    password: &#039;&#064;Czm388512369.&#039;<br \/>\n    connectionTimeoutMilliseconds: 30000<br \/>\n    idleTimeoutMilliseconds: 60000<br \/>\n    maxLifetimeMilliseconds: 1800000<br \/>\n    maxPoolSize: 50<br \/>\n    minPoolSize: 1<br \/>\n  server_user1:                                      # \u7269\u7406\u6570\u636e\u6e90 1<br \/>\n    url: jdbc:mysql:\/\/192.168.80.138:53311\/test_db_id1?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;useSSL&#061;false<br \/>\n    username: backup<br \/>\n    password: 123456<br \/>\n    connectionTimeoutMilliseconds: 30000<br \/>\n    idleTimeoutMilliseconds: 60000<br \/>\n    maxLifetimeMilliseconds: 1800000<br \/>\n    maxPoolSize: 50<br \/>\n    minPoolSize: 1<\/p>\n<p>rules:<br \/>\n  &#8211; !SHARDING<br \/>\n    tables:<br \/>\n      t_goods:                                       # \u903b\u8f91\u8868\u540d&#xff08;\u5e94\u7528 SQL \u91cc\u5199\u7684\u8868\u540d&#xff09;<br \/>\n        # \u884c\u8868\u8fbe\u5f0f&#xff0c;\u5c55\u5f00\u540e\u662f 4 \u4e2a\u771f\u5b9e\u8282\u70b9&#xff1a;<br \/>\n        # server_user0.goods_id_gd0 \/ server_user0.goods_id_gd1<br \/>\n        # server_user1.goods_id_gd0 \/ server_user1.goods_id_gd1<br \/>\n        actualDataNodes: server_user${0..1}.goods_id_gd${0..1}<\/p>\n<p>        databaseStrategy:                            # \u5206\u5e93\u7b56\u7565&#xff08;\u9009\u5e93&#xff09;<br \/>\n          standard:                                  # \u6807\u51c6\u5206\u7247&#xff1a;\u5355\u5206\u7247\u952e&#xff0c;\u652f\u6301 &#061;\u3001IN\u3001\u8303\u56f4<br \/>\n            shardingColumn: user_id                  # \u5206\u7247\u952e<br \/>\n            shardingAlgorithmName: alg_mod           # \u5f15\u7528\u7b97\u6cd5<\/p>\n<p>        tableStrategy:                               # \u5206\u8868\u7b56\u7565&#xff08;\u9009\u8868&#xff09;<br \/>\n          standard:<br \/>\n            shardingColumn: goods_id<br \/>\n            shardingAlgorithmName: alg_hash_mod<\/p>\n<p>        keyGenerateStrategy:                         # \u5206\u5e03\u5f0f\u4e3b\u952e<br \/>\n          column: id<br \/>\n          keyGeneratorName: snowflake<\/p>\n<p>    bindingTables:                                   # \u7ed1\u5b9a\u8868<br \/>\n      &#8211; t_goods,t_goods_item<br \/>\n    broadcastTables:                                 # \u5e7f\u64ad\u8868<br \/>\n      &#8211; t_dict<\/p>\n<p>    shardingAlgorithms:                              # \u5206\u7247\u7b97\u6cd5\u5b9a\u4e49<br \/>\n      alg_mod:<br \/>\n        type: MOD                                    # \u53d6\u6a21&#xff08;\u5206\u7247\u952e\u987b\u4e3a\u6570\u503c&#xff09;<br \/>\n        props:<br \/>\n          sharding-count: 2                          # \u5206\u7247\u503c % 2<br \/>\n      alg_hash_mod:<br \/>\n        type: HASH_MOD                               # \u5148\u54c8\u5e0c\u518d\u53d6\u6a21&#xff08;\u5b57\u7b26\u4e32\u4e5f\u80fd\u7528&#xff09;<br \/>\n        props:<br \/>\n          sharding-count: 2<br \/>\n      alg_inline:<br \/>\n        type: INLINE                                 # \u884c\u8868\u8fbe\u5f0f<br \/>\n        props:<br \/>\n          algorithm-expression: server_user${user_id % 2}<\/p>\n<p>    keyGenerators:<br \/>\n      snowflake:<br \/>\n        type: SNOWFLAKE<br \/>\n        props:<br \/>\n          worker-id: 1<\/p>\n<h3>5.3 \u884c\u8868\u8fbe\u5f0f<\/h3>\n<ul>\n<li>${0..1}&#xff1a;\u8fde\u7eed\u679a\u4e3e&#xff1b;${[a,b,c]}&#xff1a;\u79bb\u6563\u679a\u4e3e&#xff1b;<\/li>\n<li>server_user${0..1}.goods_id_gd${0..1} \u662f\u4e24\u4fa7\u679a\u4e3e\u7684\u7b1b\u5361\u5c14\u7ec4\u5408&#xff0c;\u5f97\u5230 4 \u4e2a\u8282\u70b9\u3002<\/li>\n<\/ul>\n<h3>5.4 \u5206\u7247\u7b56\u7565<\/h3>\n<table>\n<tr>\u7b56\u7565\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>STANDARD<\/td>\n<td>\u5355\u5206\u7247\u952e&#xff0c;\u5904\u7406\u7cbe\u786e&#xff08;&#061;\u3001IN&#xff09;\u548c\u8303\u56f4&#xff08;&gt;\u3001&lt;\u3001BETWEEN&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>COMPLEX<\/td>\n<td>\u591a\u5206\u7247\u952e<\/td>\n<\/tr>\n<tr>\n<td>HINT<\/td>\n<td>\u4e0d\u4f9d\u8d56 SQL&#xff0c;\u4ee3\u7801\u624b\u52a8\u6307\u5b9a\u8def\u7531<\/td>\n<\/tr>\n<tr>\n<td>NONE<\/td>\n<td>\u4e0d\u5f3a\u5236<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>5.5 \u5206\u7247\u7b97\u6cd5<\/h3>\n<table>\n<tr>\u7b97\u6cd5\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>MOD<\/td>\n<td>\u5206\u7247\u503c\u76f4\u63a5\u53d6\u6a21&#xff08;\u6570\u503c&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>HASH_MOD<\/td>\n<td>\u5148\u54c8\u5e0c\u518d\u53d6\u6a21&#xff08;\u5b57\u7b26\u4e32\u53ef\u7528&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>INLINE<\/td>\n<td>Groovy \u8868\u8fbe\u5f0f&#xff0c;\u6700\u7075\u6d3b<\/td>\n<\/tr>\n<tr>\n<td>INTERVAL<\/td>\n<td>\u6309\u65f6\u95f4\u533a\u95f4&#xff08;\u6309\u6708\/\u5929&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>BOUNDARY_RANGE \/ VOLUME_RANGE<\/td>\n<td>\u6309\u8303\u56f4\/\u5bb9\u91cf<\/td>\n<\/tr>\n<tr>\n<td>CLASS<\/td>\n<td>\u81ea\u5b9a\u4e49\u7b97\u6cd5\u7c7b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u516d\u3001\u7ed1\u5b9a\u8868&#xff08;bind&#xff09;\u5b8c\u6574\u573a\u666f<\/h2>\n<h3>6.1 \u6784\u9020\u573a\u666f<\/h3>\n<p>t_order \u548c t_order_item \u90fd\u6309 order_id \u5206 2 \u4e2a\u5e93&#xff08;\u5076\u6570\u2192ds0&#xff0c;\u5947\u6570\u2192ds1&#xff09;\u3002<\/p>\n<p>\u8fd9\u6837\u5b50\u505a\u4e5f\u80fd\u591f\u786e\u4fdd\u6709\u5173\u6570\u636e\u5728\u540c\u4e00\u4e2a\u5e93\u4e2d&#xff0c;\u907f\u514d\u8de8\u5e93\u4e8b\u52a1<\/p>\n<p>ds0&#xff1a;<\/p>\n<p> &#8212; t_order<br \/>\norder_id&#061;100 user_id&#061;1 amount&#061;100<br \/>\norder_id&#061;102 user_id&#061;2 amount&#061;200<br \/>\n&#8212; t_order_item<br \/>\nitem_id&#061;1 order_id&#061;100 goods&#061;&#039;\u624b\u673a&#039;<br \/>\nitem_id&#061;2 order_id&#061;100 goods&#061;&#039;\u8033\u673a&#039;<br \/>\nitem_id&#061;3 order_id&#061;102 goods&#061;&#039;\u7535\u8111&#039;<\/p>\n<p>ds1&#xff1a;<\/p>\n<p> &#8212; t_order<br \/>\norder_id&#061;101 user_id&#061;3 amount&#061;50<br \/>\norder_id&#061;103 user_id&#061;4 amount&#061;80<br \/>\n&#8212; t_order_item<br \/>\nitem_id&#061;4 order_id&#061;101 goods&#061;&#039;\u4e66&#039;<br \/>\nitem_id&#061;5 order_id&#061;103 goods&#061;&#039;\u952e\u76d8&#039;<\/p>\n<p>\u5168\u91cf\u5173\u8054\u67e5\u8be2&#xff1a;<\/p>\n<p> SELECT o.order_id, i.goods<br \/>\nFROM t_order o<br \/>\nJOIN t_order_item i ON o.order_id &#061; i.order_id;<\/p>\n<h3>6.2 \u6ca1\u6709\u914d\u7f6e bindingTables&#xff08;\u7b1b\u5361\u5c14\u79ef\u8def\u7531&#xff09;<\/h3>\n<p>Proxy \u4e0d\u77e5\u9053\u4e24\u8868\u5206\u7247\u89c4\u5219\u76f8\u540c&#xff0c;\u628a\u8def\u7531\u96c6\u5408\u505a\u7b1b\u5361\u5c14\u79ef&#xff1a;t_order \u96c6\u5408 {ds0,ds1} \u00d7 t_order_item \u96c6\u5408 {ds0,ds1} &#061; 4 \u6761 SQL&#xff1a;<\/p>\n<table>\n<tr>\u7f16\u53f7\u4f4d\u7f6e\u7ed3\u679c<\/tr>\n<tbody>\n<tr>\n<td>\u2460<\/td>\n<td>ds0.t_order \u00d7 ds0.t_order_item<\/td>\n<td>\u6709\u6548\u672c\u5730 JOIN<\/td>\n<\/tr>\n<tr>\n<td>\u2461<\/td>\n<td>ds1.t_order \u00d7 ds1.t_order_item<\/td>\n<td>\u6709\u6548\u672c\u5730 JOIN<\/td>\n<\/tr>\n<tr>\n<td>\u2462<\/td>\n<td>ds0 \u00d7 ds1<\/td>\n<td>\u8de8\u5e93 JOIN&#xff0c;MySQL \u65e0\u6cd5\u6267\u884c&#xff0c;\u6570\u636e\u62c9\u5230\u5185\u5b58\u5f52\u5e76<\/td>\n<\/tr>\n<tr>\n<td>\u2463<\/td>\n<td>ds1 \u00d7 ds0<\/td>\n<td>\u8de8\u5e93 JOIN&#xff0c;MySQL \u65e0\u6cd5\u6267\u884c&#xff0c;\u6570\u636e\u62c9\u5230\u5185\u5b58\u5f52\u5e76<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5e26 WHERE o.order_id&#061;100 \u65f6&#xff1a;t_order \u80fd\u786e\u5b9a\u5230 ds0&#xff0c;\u4f46 t_order_item \u672a\u88ab\u58f0\u660e\u7ed1\u5b9a&#xff0c;\u4ecd\u5411 ds0\u3001ds1 \u90fd\u53d1&#xff0c;\u4ea7\u751f 2 \u6761 SQL&#xff08;ds1 \u767d\u8dd1&#xff09;\u3002<\/p>\n<h3>6.3 \u914d\u7f6e\u7ed1\u5b9a\u8868\u540e<\/h3>\n<p>     bindingTables:<br \/>\n      &#8211; t_order,t_order_item<\/p>\n<p>Proxy \u77e5\u9053\u540c\u4e00 order_id \u7684\u8ba2\u5355\u548c\u660e\u7ec6\u5fc5\u5728\u540c\u4e00\u8282\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u5168\u91cf JOIN&#xff1a;\u53ea\u4e0b\u53d1 2 \u6761&#xff08;ds0\u3001ds1 \u5404\u672c\u5730 JOIN&#xff09;&#xff1b;<\/li>\n<li>\u5e26 order_id&#061;100&#xff1a;\u7cbe\u786e\u8def\u7531\u5230 ds0&#xff0c;\u53ea\u4e0b\u53d1 1 \u6761\u3002<\/li>\n<\/ul>\n<h3>6.4 \u5bf9\u6bd4<\/h3>\n<table>\n<tr>\u60c5\u5f62\u5168\u91cf JOIN\u5e26 order_id&#061;100\u8de8\u5e93 JOIN<\/tr>\n<tbody>\n<tr>\n<td>\u672a\u7ed1\u5b9a<\/td>\n<td>4 \u6761&#xff08;2\u00d72&#xff09;<\/td>\n<td>2 \u6761<\/td>\n<td>\u6709&#xff0c;\u5185\u5b58\u5f52\u5e76<\/td>\n<\/tr>\n<tr>\n<td>\u7ed1\u5b9a<\/td>\n<td>2 \u6761&#xff08;\u672c\u5730&#xff09;<\/td>\n<td>1 \u6761&#xff08;\u7cbe\u786e&#xff09;<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u4e03\u3001\u5e7f\u64ad\u8868\u5b8c\u6574\u573a\u666f<\/h2>\n<p>\u672c\u8d28\u4e0a\u5c31\u662f\u5728\u6bcf\u4e00\u4e2a\u5e93\u4e2d\u90fd\u5907\u4efd\u4e00\u4e2a\u76f8\u540c\u7684\u8868&#xff0c;\u4ee5\u907f\u514d\u8de8\u5e93\u4e8b\u52a1<\/p>\n<h3>7.1 \u6784\u9020\u573a\u666f<\/h3>\n<p>t_dict \u662f\u8ba2\u5355\u72b6\u6001\u5b57\u5178\u8868&#xff08;5 \u884c&#xff0c;\u51e0\u4e4e\u4e0d\u53d8&#xff09;&#xff0c;t_order \u662f\u5206\u7247\u8868&#xff1a;<\/p>\n<p> status_code&#061;1 status_name&#061;&#039;\u5f85\u652f\u4ed8&#039;<br \/>\nstatus_code&#061;2 status_name&#061;&#039;\u5df2\u652f\u4ed8&#039;<br \/>\nstatus_code&#061;3 status_name&#061;&#039;\u5df2\u53d1\u8d27&#039;<br \/>\nstatus_code&#061;4 status_name&#061;&#039;\u5df2\u5b8c\u6210&#039;<\/p>\n<p>\u67e5\u8be2&#xff1a;<\/p>\n<p> SELECT o.order_id, d.status_name<br \/>\nFROM t_order o JOIN t_dict d ON o.status &#061; d.status_code;<\/p>\n<h3>7.2 \u6ca1\u6709\u5e7f\u64ad\u8868&#xff08;\u5b57\u5178\u53ea\u5728 ds0&#xff09;<\/h3>\n<ul>\n<li>ds0 \u80fd\u672c\u5730 JOIN&#xff1b;<\/li>\n<li>ds1 \u6ca1\u6709 t_dict&#xff0c;\u65e0\u6cd5\u672c\u5730 JOIN&#xff0c;Proxy \u53ea\u80fd\u628a ds0 \u7684\u5b57\u5178\u548c ds1 \u7684\u8ba2\u5355\u62c9\u5230\u5185\u5b58\u5f52\u5e76&#xff1b;<\/li>\n<li>\u4e14\u5728 ds0 \u65b0\u589e\u72b6\u6001&#xff08;\u5982&#034;\u5df2\u9000\u6b3e&#034;&#xff09;\u540e&#xff0c;ds1 \u4e0d\u77e5\u9053&#xff0c;\u5b57\u5178\u526f\u672c\u4e0d\u4e00\u81f4\u3002<\/li>\n<\/ul>\n<h3>7.3 \u914d\u7f6e\u5e7f\u64ad\u8868\u540e<\/h3>\n<p>     broadcastTables:<br \/>\n      &#8211; t_dict<\/p>\n<ul>\n<li>\u67e5\u8be2&#xff1a;t_dict \u5728 ds0\u3001ds1 \u5404\u6709\u4e00\u4efd\u5b8c\u6574\u526f\u672c&#xff0c;\u6bcf\u4e2a\u5e93\u90fd\u80fd\u672c\u5730 JOIN&#xff1b;<\/li>\n<li>\u5199\u5165\u81ea\u52a8\u5e7f\u64ad&#xff1a; INSERT INTO t_dict VALUES (5, &#039;\u5df2\u9000\u6b3e&#039;);<br \/>\n Proxy \u81ea\u52a8\u5411\u6240\u6709\u8282\u70b9\u4e0b\u53d1&#xff1a; \u2192 ds0: INSERT INTO t_dict VALUES (5,&#039;\u5df2\u9000\u6b3e&#039;);<br \/>\n\u2192 ds1: INSERT INTO t_dict VALUES (5,&#039;\u5df2\u9000\u6b3e&#039;);\n <\/li>\n<li>\u5355\u8868\u67e5\u8be2&#xff1a;SELECT * FROM t_dict \u968f\u4fbf\u8def\u7531\u5230\u4e00\u4e2a\u8282\u70b9\u5373\u53ef\u3002<\/li>\n<\/ul>\n<h3>7.4 \u9009\u7528\u6761\u4ef6<\/h3>\n<table>\n<tr>\u7279\u5f81\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>\u6570\u636e\u91cf\u5c0f<\/td>\n<td>\u5168\u91cf\u526f\u672c&#xff0c;\u592a\u5927\u6d6a\u8d39\u5b58\u50a8<\/td>\n<\/tr>\n<tr>\n<td>\u8bfb\u591a\u5199\u5c11<\/td>\n<td>\u5199\u8981\u5e7f\u64ad&#xff0c;\u5199\u9891\u7e41\u6210\u672c\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>\u7ecf\u5e38\u88ab JOIN\/\u67e5\u8be2<\/td>\n<td>\u5e7f\u64ad\u6536\u76ca\u5c31\u5728\u672c\u5730 JOIN<\/td>\n<\/tr>\n<tr>\n<td>\u4e00\u81f4\u6027\u8981\u6c42\u9ad8<\/td>\n<td>Proxy \u81ea\u52a8\u7ef4\u62a4\u526f\u672c\u4e00\u81f4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5178\u578b&#xff1a;\u5b57\u5178\u8868\u3001\u914d\u7f6e\u8868\u3001\u5730\u533a\u8868\u3002<\/p>\n<hr \/>\n<h2>\u516b\u3001\u7edf\u4e00\u5e8f\u5217\u53f7&#xff08;\u5206\u5e03\u5f0f\u4e3b\u952e&#xff09;<\/h2>\n<h3>8.1 \u4e3a\u4ec0\u4e48\u5206\u5e93\u5206\u8868\u540e\u9700\u8981<\/h3>\n<p>\u5206\u5e93\/\u5206\u8868\u540e&#xff0c;\u6bcf\u4e2a\u5e93\u5404\u81ea\u81ea\u589e&#xff0c;\u4f1a\u4ea7\u751f\u91cd\u590d\u4e3b\u952e&#xff08;\u5e93 0 \u548c\u5e93 1 \u90fd\u4ece 1 \u5f00\u59cb&#xff09;&#xff0c;\u56e0\u6b64\u5fc5\u987b\u6709\u5168\u5c40\u552f\u4e00 ID \u65b9\u6848\u3002<\/p>\n<h3>8.2 \u96ea\u82b1\u7b97\u6cd5&#xff08;Snowflake&#xff0c;ShardingSphere \u9ed8\u8ba4&#xff09;<\/h3>\n<p>64 \u4f4d long \u578b ID&#xff0c;\u5206\u56db\u6bb5&#xff1a;<\/p>\n<p>  1 bit     41 bit \u65f6\u95f4\u6233        10 bit \u5de5\u4f5c\u673a\u5668        12 bit \u5e8f\u5217\u53f7<br \/>\n\u250c\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 0\u2502   \u6beb\u79d2\u7ea7\u65f6\u95f4\u6233       \u2502 5\u4f4d\u6570\u636e\u4e2d\u5fc3&#043;5\u4f4d\u673a\u5668\u2502 \u540c\u6beb\u79d2\u5185\u81ea\u589e\u5e8f\u5217   \u2502<br \/>\n\u2514\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<ul>\n<li>1 \u4f4d\u7b26\u53f7&#xff1a;\u56fa\u5b9a 0&#xff0c;\u4fdd\u8bc1\u6b63\u6570&#xff1b;<\/li>\n<li>41 \u4f4d\u65f6\u95f4\u6233&#xff1a;\u6beb\u79d2\u7ea7&#xff0c;\u53ef\u7528\u7ea6 69 \u5e74&#xff1b;<\/li>\n<li>10 \u4f4d\u5de5\u4f5c\u673a\u5668&#xff1a;5 \u4f4d\u6570\u636e\u4e2d\u5fc3 &#043; 5 \u4f4d\u673a\u5668&#xff0c;\u5171 1024 \u4e2a\u8282\u70b9&#xff1b;<\/li>\n<li>12 \u4f4d\u5e8f\u5217\u53f7&#xff1a;\u540c\u4e00\u6beb\u79d2\u53ef\u751f\u6210 4096 \u4e2a ID\u3002<\/li>\n<\/ul>\n<p>\u4f18\u70b9&#xff1a;\u672c\u5730\u751f\u6210\u65e0\u7f51\u7edc\u5f00\u9500\u3001\u6027\u80fd\u9ad8\u3001\u6574\u4f53\u8d8b\u52bf\u9012\u589e&#xff08;\u5bf9 B&#043; \u6811\u7d22\u5f15\u53cb\u597d&#xff09;\u3002<\/p>\n<h3>8.3 \u65f6\u949f\u56de\u62e8<\/h3>\n<p>\u673a\u5668\u65f6\u949f\u56e0 NTP \u6821\u65f6\u5f80\u56de\u62e8\u65f6\u53ef\u80fd\u751f\u6210\u91cd\u590d ID\u3002&#xff08;\u8fd9\u4e5f\u8981\u6c42\u4e86\u6211\u4eec\u4e0d\u80fd\u591f\u8f7b\u6613\u66f4\u6362\u65f6\u533a&#xff09;<\/p>\n<p>\u5904\u7406&#xff1a;\u8bb0\u5f55\u4e0a\u6b21\u65f6\u95f4\u6233&#xff0c;\u56de\u62e8\u5f88\u5c0f\u5219\u7b49\u5f85\u8ffd\u4e0a&#xff0c;\u56de\u62e8\u8f83\u5927\u5219\u62a5\u9519\u62d2\u7edd\u3002<\/p>\n<h3>8.4 \u5176\u4ed6\u65b9\u6848<\/h3>\n<table>\n<tr>\u65b9\u6848\u4f18\u7f3a\u70b9<\/tr>\n<tbody>\n<tr>\n<td>UUID<\/td>\n<td>\u7b80\u5355\u4f46\u65e0\u5e8f\u3001\u592a\u957f&#xff0c;B&#043; \u6811\u63d2\u5165\u6027\u80fd\u5dee<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u5e93\u53f7\u6bb5&#xff08;\u7f8e\u56e2 Leaf&#xff09;<\/td>\n<td>\u6279\u91cf\u53d6\u53f7&#xff0c;\u538b\u529b\u5c0f<\/td>\n<\/tr>\n<tr>\n<td>Redis INCR<\/td>\n<td>\u7b80\u5355\u9ad8\u6027\u80fd&#xff0c;\u4f9d\u8d56 Redis \u9ad8\u53ef\u7528<\/td>\n<\/tr>\n<tr>\n<td>\u767e\u5ea6 UidGenerator<\/td>\n<td>\u96ea\u82b1\u53d8\u79cd &#043; RingBuffer&#xff0c;\u6781\u9ad8\u6027\u80fd<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>8.5 \u914d\u7f6e<\/h3>\n<p>         keyGenerateStrategy:<br \/>\n          column: id<br \/>\n          keyGeneratorName: snowflake<br \/>\n    keyGenerators:<br \/>\n      snowflake:<br \/>\n        type: SNOWFLAKE<br \/>\n        props:<br \/>\n          worker-id: 1<\/p>\n<p>\u63d2\u5165\u65f6\u4e0d\u6307\u5b9a id&#xff0c;Proxy \u81ea\u52a8\u586b\u5145\u96ea\u82b1 ID\u3002<\/p>\n<hr \/>\n<h2>\u4e5d\u3001\u8bfb\u5199\u5206\u79bb &#043; \u591a\u96c6\u7fa4\u5782\u76f4\u5206\u5e93&#xff08;\u5176\u4f59\u7ec4\u5408\u53ef\u4ee5\u53c2\u8003&#xff09;<\/h2>\n<h3>9.1 \u67b6\u6784\u5f62\u6001<\/h3>\n<p>\u591a\u4e2a\u4e1a\u52a1\u96c6\u7fa4&#xff0c;\u6bcf\u4e2a\u96c6\u7fa4\u5185\u90e8\u662f\u4e00\u4e3b\u591a\u4ece\u7684\u8bfb\u5199\u5206\u79bb&#xff0c;\u96c6\u7fa4\u4e4b\u95f4\u662f\u5782\u76f4\u5206\u5e93&#xff1a;<\/p>\n<p>                     ShardingSphere-Proxy :3307&#xff08;\u903b\u8f91\u5e93 mall_db&#xff09;<br \/>\n                                  \u2502<br \/>\n          \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n          \u25bc                                                 \u25bc<br \/>\n   \u7528\u6237\u5e93\u96c6\u7fa4 user_ds                                  \u8ba2\u5355\u5e93\u96c6\u7fa4 order_ds<br \/>\n   \u251c\u2500 user_master  \u5199  3306                            \u251c\u2500 order_master \u5199  53311<br \/>\n   \u251c\u2500 user_slave0  \u8bfb  53307                           \u2514\u2500 order_slave0 \u8bfb  53312<br \/>\n   \u2514\u2500 user_slave1  \u8bfb  53308<br \/>\n          \u2502                                                 \u2502<br \/>\n   t_user \/ t_user_log                                 t_order \/ t_order_item<br \/>\n                                                       t_goods \/ t_goods_desc&#xff08;\u5782\u76f4\u5206\u8868&#xff09;<\/p>\n<p>\u6838\u5fc3\u601d\u8def&#xff1a;\u5148\u7528 READWRITE_SPLITTING \u628a\u6bcf\u4e2a\u96c6\u7fa4\u7684\u7269\u7406\u4e3b\u4ece\u5c01\u88c5\u6210\u4e00\u4e2a\u903b\u8f91\u6570\u636e\u6e90&#xff08;user_ds\u3001order_ds&#xff09;&#xff0c;\u518d\u7528 SHARDING \u7684 actualDataNodes \u5f15\u7528\u8fd9\u4e9b\u903b\u8f91\u6570\u636e\u6e90\u2014\u2014\u4e24\u6761\u89c4\u5219\u53e0\u52a0&#xff0c;\u8def\u7531\u4e24\u5c42\u7ea7\u8054\u3002<\/p>\n<h3>9.2 \u5b8c\u6574\u914d\u7f6e<\/h3>\n<p> databaseName: mall_db<\/p>\n<p>dataSources:<br \/>\n  # \u2500\u2500\u2500\u2500\u2500 \u7528\u6237\u5e93\u96c6\u7fa4&#xff08;\u4e00\u4e3b\u4e24\u4ece&#xff09; \u2500\u2500\u2500\u2500\u2500<br \/>\n  user_master:<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:3306\/db_user?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;useSSL&#061;false<br \/>\n    username: root<br \/>\n    password: &#039;123456&#039;<br \/>\n  user_slave0:<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:53307\/db_user?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;useSSL&#061;false<br \/>\n    username: root<br \/>\n    password: &#039;123456&#039;<br \/>\n  user_slave1:<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:53308\/db_user?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;useSSL&#061;false<br \/>\n    username: root<br \/>\n    password: &#039;123456&#039;<\/p>\n<p>  # \u2500\u2500\u2500\u2500\u2500 \u8ba2\u5355\u5e93\u96c6\u7fa4&#xff08;\u4e00\u4e3b\u4e00\u4ece&#xff09; \u2500\u2500\u2500\u2500\u2500<br \/>\n  order_master:<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:53311\/db_order?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;useSSL&#061;false<br \/>\n    username: root<br \/>\n    password: &#039;123456&#039;<br \/>\n  order_slave0:<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:53312\/db_order?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;useSSL&#061;false<br \/>\n    username: root<br \/>\n    password: &#039;123456&#039;<\/p>\n<p>rules:<br \/>\n  # \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 \u89c4\u5219 1&#xff1a;\u8bfb\u5199\u5206\u79bb&#xff08;\u628a\u6bcf\u4e2a\u96c6\u7fa4\u5c01\u88c5\u6210\u903b\u8f91\u6570\u636e\u6e90&#xff09; \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550<br \/>\n  &#8211; !READWRITE_SPLITTING<br \/>\n    dataSources:<br \/>\n      user_ds:                                         # \u7528\u6237\u5e93\u96c6\u7fa4\u903b\u8f91\u6570\u636e\u6e90<br \/>\n        staticStrategy:<br \/>\n          writeDataSourceName: user_master<br \/>\n          readDataSourceNames:<br \/>\n            &#8211; user_slave0<br \/>\n            &#8211; user_slave1<br \/>\n        loadBalancerName: round_robin<br \/>\n      order_ds:                                        # \u8ba2\u5355\u5e93\u96c6\u7fa4\u903b\u8f91\u6570\u636e\u6e90<br \/>\n        staticStrategy:<br \/>\n          writeDataSourceName: order_master<br \/>\n          readDataSourceNames:<br \/>\n            &#8211; order_slave0<br \/>\n        loadBalancerName: round_robin<br \/>\n    loadBalancers:<br \/>\n      round_robin:<br \/>\n        type: ROUND_ROBIN<\/p>\n<p>  # \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 \u89c4\u5219 2&#xff1a;\u5782\u76f4\u5206\u5e93&#xff08;\u903b\u8f91\u8868 \u2192 \u903b\u8f91\u6570\u636e\u6e90&#xff09; \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550<br \/>\n  &#8211; !SHARDING<br \/>\n    tables:<br \/>\n      # \u7528\u6237\u57df\u7684\u8868\u5168\u90e8\u843d\u5728\u7528\u6237\u5e93\u96c6\u7fa4<br \/>\n      t_user:<br \/>\n        actualDataNodes: user_ds.t_user<br \/>\n      t_user_log:<br \/>\n        actualDataNodes: user_ds.t_user_log<\/p>\n<p>      # \u8ba2\u5355\u57df\u7684\u8868\u5168\u90e8\u843d\u5728\u8ba2\u5355\u5e93\u96c6\u7fa4<br \/>\n      t_order:<br \/>\n        actualDataNodes: order_ds.t_order<br \/>\n      t_order_item:<br \/>\n        actualDataNodes: order_ds.t_order_item<\/p>\n<p>      # \u5782\u76f4\u5206\u8868&#xff1a;\u5546\u54c1\u4e3b\u8868\u4e0e\u5927\u5b57\u6bb5\u6269\u5c55\u8868&#xff08;1:1&#xff09;&#xff0c;\u90fd\u5728\u8ba2\u5355\u5e93\u96c6\u7fa4<br \/>\n      t_goods:<br \/>\n        actualDataNodes: order_ds.t_goods<br \/>\n      t_goods_desc:<br \/>\n        actualDataNodes: order_ds.t_goods_desc<\/p>\n<p>    bindingTables:<br \/>\n      &#8211; t_order,t_order_item<br \/>\n    broadcastTables:<br \/>\n      &#8211; t_dict<\/p>\n<h3>9.3 \u8def\u7531\u9a8c\u8bc1<\/h3>\n<table>\n<tr>SQL\u8def\u7531\u8fc7\u7a0b\u5b9e\u9645\u8282\u70b9<\/tr>\n<tbody>\n<tr>\n<td>INSERT INTO t_user &#8230;<\/td>\n<td>\u5206\u7247\u2192user_ds&#xff1b;\u8bfb\u5199\u5206\u79bb\u2192\u4e3b<\/td>\n<td>user_master:3306<\/td>\n<\/tr>\n<tr>\n<td>SELECT * FROM t_user &#8230;<\/td>\n<td>\u5206\u7247\u2192user_ds&#xff1b;\u8bfb\u5199\u5206\u79bb\u2192\u4ece&#xff08;\u8f6e\u8be2&#xff09;<\/td>\n<td>user_slave0:53307<\/td>\n<\/tr>\n<tr>\n<td>INSERT INTO t_order &#8230;<\/td>\n<td>\u5206\u7247\u2192order_ds&#xff1b;\u8bfb\u5199\u5206\u79bb\u2192\u4e3b<\/td>\n<td>order_master:53311<\/td>\n<\/tr>\n<tr>\n<td>SELECT * FROM t_order &#8230;<\/td>\n<td>\u5206\u7247\u2192order_ds&#xff1b;\u8bfb\u5199\u5206\u79bb\u2192\u4ece<\/td>\n<td>order_slave0:53312<\/td>\n<\/tr>\n<tr>\n<td>SELECT * FROM t_dict<\/td>\n<td>\u5e7f\u64ad\u8868&#xff0c;\u4efb\u610f\u8282\u70b9<\/td>\n<td>\u968f\u673a\u8282\u70b9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e24\u7ea7\u8def\u7531&#xff1a;\u5148\u7531 SHARDING \u51b3\u5b9a&#034;\u53bb\u54ea\u4e2a\u4e1a\u52a1\u96c6\u7fa4&#034;&#xff0c;\u518d\u7531 READWRITE_SPLITTING \u51b3\u5b9a&#034;\u8d70\u8be5\u96c6\u7fa4\u7684\u4e3b\u8fd8\u662f\u4ece&#034;\u3002<\/p>\n<h3>9.4 \u5173\u4e8e\u5782\u76f4\u5206\u8868<\/h3>\n<p>\u5782\u76f4\u5206\u8868\u662f\u540c\u4e00\u4e2a\u5e93\u5185\u628a\u5927\u5b57\u6bb5\u62c6\u6210 1:1 \u6269\u5c55\u8868&#xff08;\u5982 t_goods \u62c6\u51fa t_goods_desc&#xff09;&#xff0c;\u7269\u7406\u4e0a\u5c31\u662f\u4e24\u5f20\u72ec\u7acb\u8868&#xff0c;\u4e0d\u9700\u8981\u5206\u7247\u7b97\u6cd5&#xff0c;\u5728\u540c\u4e00\u6570\u636e\u6e90\u4e0b\u5206\u522b\u58f0\u660e\u5373\u53ef&#xff08;\u89c1 9.2&#xff09;&#xff1b;\u5e94\u7528\u5c42\u6309\u9700\u67e5\u8be2\u6216\u7528 goods_id \u5173\u8054\u3002\u82e5\u4ee5\u540e\u8fd8\u8981\u6c34\u5e73\u62c6\u5206&#xff0c;\u518d\u4e3a\u5b83\u4eec\u914d\u7f6e\u76f8\u540c\u5206\u7247\u952e\u5e76\u52a0\u5165 bindingTables\u3002<\/p>\n<hr \/>\n<h2>\u5341\u3001CAP \u7406\u8bba<\/h2>\n<h3>10.1 \u4e09\u8981\u7d20<\/h3>\n<table>\n<tr>\u8981\u7d20\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>C&#xff1a;\u4e00\u81f4\u6027<\/td>\n<td>\u6240\u6709\u8282\u70b9\u540c\u4e00\u65f6\u523b\u770b\u5230\u76f8\u540c\u6570\u636e&#xff0c;\u8bfb\u603b\u8fd4\u56de\u6700\u65b0\u5199\u5165<\/td>\n<\/tr>\n<tr>\n<td>A&#xff1a;\u53ef\u7528\u6027<\/td>\n<td>\u6bcf\u4e2a\u975e\u6545\u969c\u8282\u70b9\u7684\u8bf7\u6c42\u90fd\u80fd\u5728\u6709\u9650\u65f6\u95f4\u5185\u5f97\u5230\u54cd\u5e94<\/td>\n<\/tr>\n<tr>\n<td>P&#xff1a;\u5206\u533a\u5bb9\u9519\u6027<\/td>\n<td>\u7f51\u7edc\u5206\u533a&#xff08;\u4e2d\u65ad\/\u4e22\u6d88\u606f&#xff09;\u65f6\u7cfb\u7edf\u4ecd\u80fd\u5de5\u4f5c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>10.2 \u4e3a\u4ec0\u4e48 P \u5fc5\u9009<\/h3>\n<p>\u7f51\u7edc\u5206\u533a\u4e0d\u53ef\u907f\u514d&#xff0c;\u65e0\u6cd5\u9009\u62e9&#034;\u4e0d\u8981 P&#034;\u3002\u5b9e\u9645\u6743\u8861\u662f\u5206\u533a\u53d1\u751f\u65f6\u8981 C \u8fd8\u662f A&#xff1a;<\/p>\n<ul>\n<li>CP&#xff1a;\u5206\u533a\u65f6\u62d2\u7edd\u90e8\u5206\u8bf7\u6c42\u4fdd\u4e00\u81f4&#xff0c;\u727a\u7272\u53ef\u7528\u6027&#xff1b;<\/li>\n<li>AP&#xff1a;\u5206\u533a\u65f6\u5404\u8282\u70b9\u7ee7\u7eed\u670d\u52a1&#xff0c;\u5141\u8bb8\u77ed\u6682\u4e0d\u4e00\u81f4&#xff0c;\u6062\u590d\u540e\u518d\u540c\u6b65\u3002<\/li>\n<\/ul>\n<h3>10.3 \u5178\u578b\u7cfb\u7edf<\/h3>\n<table>\n<tr>\u7c7b\u578b\u7cfb\u7edf<\/tr>\n<tbody>\n<tr>\n<td>CP<\/td>\n<td>ZooKeeper\u3001etcd\u3001HBase\u3001MongoDB&#xff08;\u9ed8\u8ba4&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>AP<\/td>\n<td>Cassandra\u3001Dynamo\u3001Eureka\u3001Redis Cluster<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5bf9\u5e94\u5b66\u8fc7\u7684\u7ec4\u4ef6&#xff1a;<\/p>\n<ul>\n<li>MySQL \u5f02\u6b65\u4e3b\u4ece\u590d\u5236\u504f AP&#xff08;\u53ef\u80fd\u4e22\u5df2\u63d0\u4ea4\u6570\u636e&#xff09;&#xff1b;<\/li>\n<li>\u534a\u540c\u6b65\u590d\u5236\u5411 CP \u9760\u62e2&#xff1b;<\/li>\n<li>MGR \u53ef\u914d\u7f6e CP \u80fd\u529b&#xff1b;<\/li>\n<li>Redis Cluster \u5f02\u6b65\u590d\u5236\u504f AP&#xff1b;<\/li>\n<li>ZooKeeper&#xff08;ZAB&#xff09;\u662f CP&#xff08;\u9009\u4e3e\u671f\u95f4\u4e0d\u53ef\u7528&#xff09;\u3002<\/li>\n<\/ul>\n<p>CAP \u4e0d\u662f\u7b80\u5355&#034;\u4e09\u9009\u4e8c&#034;&#xff1a;\u65e0\u5206\u533a\u65f6 C \u548c A \u53ef\u540c\u65f6\u6ee1\u8db3&#xff0c;\u53ea\u6709\u5206\u533a\u671f\u95f4\u624d\u9700\u53d6\u820d\u3002<\/p>\n<h3>10.4 BASE \u7406\u8bba&#xff08;AP \u7684\u5b9e\u8df5&#xff09;<\/h3>\n<ul>\n<li>Basically Available&#xff08;\u57fa\u672c\u53ef\u7528&#xff1a;\u5141\u8bb8\u53d8\u6162\u3001\u964d\u7ea7&#xff09;&#xff1b;<\/li>\n<li>Soft State&#xff08;\u8f6f\u72b6\u6001&#xff1a;\u5141\u8bb8\u4e2d\u95f4\u72b6\u6001&#xff09;&#xff1b;<\/li>\n<li>Eventually Consistent&#xff08;\u6700\u7ec8\u4e00\u81f4\u6027&#xff1a;\u4e00\u6bb5\u65f6\u95f4\u540e\u6240\u6709\u8282\u70b9\u4e00\u81f4&#xff09;\u3002<\/li>\n<\/ul>\n<hr \/>\n<h2>\u5341\u4e00\u3001\u5206\u5e93\u5206\u8868\u5e26\u6765\u7684\u5176\u4ed6\u95ee\u9898<\/h2>\n<\/p>\n<table>\n<tr>\u95ee\u9898\u89e3\u51b3\u601d\u8def<\/tr>\n<tr>\n<td>\u5206\u5e03\u5f0f\u4e8b\u52a1<\/td>\n<td>XA&#xff08;2PC&#xff0c;\u504f CP&#xff09;\u3001Saga&#xff08;\u67d4\u6027\u4e8b\u52a1&#xff0c;\u6700\u7ec8\u4e00\u81f4&#xff09;&#xff1b;ShardingSphere \u5747\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>\u8de8\u5e93 JOIN<\/td>\n<td>\u7ed1\u5b9a\u8868\u3001\u5e7f\u64ad\u8868\u3001\u5b57\u6bb5\u5197\u4f59\u3001\u5e94\u7528\u5c42\u7ec4\u88c5<\/td>\n<\/tr>\n<tr>\n<td>\u8de8\u5e93\u5206\u9875\/\u6392\u5e8f<\/td>\n<td>\u5404\u8282\u70b9\u53d6\u6570\u540e Proxy \u5f52\u5e76&#xff08;\u6df1\u5206\u9875\u4ee3\u4ef7\u5927&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5168\u5c40\u552f\u4e00 ID<\/td>\n<td>\u96ea\u82b1\u7b97\u6cd5\u7b49<\/td>\n<\/tr>\n<tr>\n<td>\u6269\u5bb9<\/td>\n<td>\u6210\u500d\u6269\u5bb9 &#043; \u6570\u636e\u8fc1\u79fb&#xff0c;\u6216\u4e00\u81f4\u6027\u54c8\u5e0c<\/td>\n<\/tr>\n<tr>\n<td>\u805a\u5408\u51fd\u6570<\/td>\n<td>\u5404\u8282\u70b9\u90e8\u5206\u805a\u5408\u540e Proxy \u5f52\u5e76<\/td>\n<\/tr>\n<\/table>\n<h3>\u5341\u4e8c.\u9644\u5f55&#xff08;\u53ea\u5229\u7528\u8bfb\u5199\u5206\u79bb\u5b9e\u73b0\u5782\u76f4\u5206\u5e93&#xff09;<\/h3>\n<p> databaseName: readwrite_splitting_db<\/p>\n<p>dataSources:<br \/>\n  write_ds_0:<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:3306\/test_db_id?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;allowPublicKeyRetrieval&#061;true&amp;useSSL&#061;false<br \/>\n    username: root<br \/>\n    password: &#039;&#064;Czm388512369.&#039;<br \/>\n    connectionTimeoutMilliseconds: 30000<br \/>\n    idleTimeoutMilliseconds: 60000<br \/>\n    maxLifetimeMilliseconds: 1800000<br \/>\n    maxPoolSize: 50<br \/>\n    minPoolSize: 1<br \/>\n  write_ds_1:<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:53306\/test_db_desc?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;allowPublicKeyRetrieval&#061;true&amp;useSSL&#061;false<br \/>\n    username: backup<br \/>\n    password: 123456<br \/>\n    connectionTimeoutMilliseconds: 30000<br \/>\n    idleTimeoutMilliseconds: 60000<br \/>\n    maxLifetimeMilliseconds: 1800000<br \/>\n    maxPoolSize: 50<br \/>\n    minPoolSize: 1<br \/>\n  read_ds_0:<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:53307\/test_db_id?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;allowPublicKeyRetrieval&#061;true&amp;useSSL&#061;false<br \/>\n    username: backup<br \/>\n    password: 123456<br \/>\n    connectionTimeoutMilliseconds: 30000<br \/>\n    idleTimeoutMilliseconds: 60000<br \/>\n    maxLifetimeMilliseconds: 1800000<br \/>\n    maxPoolSize: 50<br \/>\n    minPoolSize: 1<br \/>\n  read_ds_1:<br \/>\n    url: jdbc:mysql:\/\/127.0.0.1:53308\/test_db_desc?characterEncoding&#061;utf8&amp;serverTimezone&#061;Asia\/Shanghai&amp;allowPublicKeyRetrieval&#061;true&amp;useSSL&#061;false<br \/>\n    username: backup<br \/>\n    password: 123456<br \/>\n    connectionTimeoutMilliseconds: 30000<br \/>\n    idleTimeoutMilliseconds: 60000<br \/>\n    maxLifetimeMilliseconds: 1800000<br \/>\n    maxPoolSize: 50<br \/>\n    minPoolSize: 1<\/p>\n<p>rules:<br \/>\n&#8211; !READWRITE_SPLITTING<br \/>\n  dataSources:<br \/>\n    readwrite_ds_0:<br \/>\n      staticStrategy:<br \/>\n        writeDataSourceName: write_ds_0<br \/>\n        readDataSourceNames:<br \/>\n          &#8211; read_ds_0<br \/>\n      loadBalancerName: round_robin<br \/>\n    readwrite_ds_1:<br \/>\n      staticStrategy:<br \/>\n        writeDataSourceName: write_ds_1<br \/>\n        readDataSourceNames:<br \/>\n          &#8211; read_ds_1<br \/>\n      loadBalancerName: round_robin<br \/>\n  loadBalancers:<br \/>\n    round_robin:<br \/>\n      type: ROUND_ROBIN <\/p>\n<table>\n<tr>\u7ef4\u5ea6\u5f53\u524d\u65b9\u6848&#xff1a;\u591a\u5957\u72ec\u7acb\u8bfb\u5199\u5206\u79bb\u5206\u7247\u6a21\u5f0f&#xff1a;\u5782\u76f4\u5206\u5e93 &#043; \u8bfb\u5199\u5206\u79bb<\/tr>\n<tbody>\n<tr>\n<td>\u5e94\u7528\u89c6\u89d2<\/td>\n<td>\u5e94\u7528\u611f\u77e5\u591a\u4e2a\u903b\u8f91\u5e93&#xff0c;\u4e0d\u540c\u4e1a\u52a1\u8868\u9700\u8981\u5207\u6362\u4e0d\u540c\u5e93\u6267\u884c<\/td>\n<td>\u5e94\u7528\u53ea\u770b\u5230\u4e00\u4e2a\u7edf\u4e00\u903b\u8f91\u5e93&#xff0c;\u6240\u6709\u8868\u90fd\u5728\u8fd9\u4e2a\u5e93\u4e0b&#xff0c;\u5b8c\u5168\u4e0d\u611f\u77e5\u5e95\u5c42\u62c6\u5206<\/td>\n<\/tr>\n<tr>\n<td>\u8de8\u5e93\u5173\u8054<\/td>\n<td>\u5b8c\u5168\u4e0d\u652f\u6301\u8de8\u903b\u8f91\u5e93 JOIN&#xff0c;\u5e94\u7528\u5fc5\u987b\u81ea\u5df1\u62c6\u4e24\u6b21\u67e5\u8be2\u518d\u62fc\u88c5<\/td>\n<td>\u652f\u6301\u8de8\u5206\u7247\u7684\u5173\u8054\u67e5\u8be2&#xff08;\u7531 Proxy \u81ea\u52a8\u6539\u5199\u3001\u5206\u53d1\u3001\u5f52\u5e76&#xff09;&#xff0c;\u5e94\u7528\u53ef\u4ee5\u6b63\u5e38\u5199 JOIN<\/td>\n<\/tr>\n<tr>\n<td>\u4e8b\u52a1\u652f\u6301<\/td>\n<td>\u8de8\u5e93\u4e8b\u52a1\u9700\u8981\u5e94\u7528\u81ea\u884c\u5904\u7406\u5206\u5e03\u5f0f\u4e8b\u52a1<\/td>\n<td>\u540c\u4e00\u4e2a\u903b\u8f91\u5e93\u5185&#xff0c;\u5185\u7f6e\u652f\u6301 XA\u3001Seata \u7b49\u5206\u5e03\u5f0f\u4e8b\u52a1\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>\u540e\u7eed\u6269\u5c55<\/td>\n<td>\u67d0\u5f20\u8868\u8981\u505a\u6c34\u5e73\u5206\u7247\u65f6&#xff0c;\u9700\u8981\u6574\u4f53\u91cd\u6784\u914d\u7f6e&#xff0c;\u6539\u52a8\u6210\u672c\u9ad8<\/td>\n<td>\u672c\u8eab\u5c31\u5728\u5206\u7247\u4f53\u7cfb\u5185&#xff0c;\u7ed9\u5355\u5f20\u8868\u52a0\u6c34\u5e73\u5206\u7247\u7b56\u7565\u5373\u53ef&#xff0c;\u67b6\u6784\u5e73\u6ed1\u6f14\u8fdb<\/td>\n<\/tr>\n<tr>\n<td>\u914d\u7f6e\u590d\u6742\u5ea6<\/td>\n<td>\u7b80\u5355\u76f4\u89c2&#xff0c;\u89c4\u5219\u5c11&#xff0c;\u6392\u9519\u5bb9\u6613<\/td>\n<td>\u914d\u7f6e\u5c42\u7ea7\u591a&#xff0c;\u5206\u7247\u7b97\u6cd5\u3001\u8def\u7531\u7b56\u7565\u590d\u6742&#xff0c;\u6392\u9519\u6210\u672c\u9ad8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u5927\u591a\u6570\u573a\u666f\u4e0b\u6ca1\u6709\u5206\u7247\u6a21\u5f0f\u597d&#xff0c;\u4f46\u662f\u4e5f\u53ef\u4ee5\u4e86\u89e3\u4e00\u4e0b&#xff08;\u535a\u4e3b\u81ea\u5df1\u7a81\u53d1\u5947\u60f3\u7684&#xff09;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#x1f4da; \u672c\u6587\u6536\u5f55\u4e8e\u300cbksczm\u300d\u7684\u7cfb\u5217\u4e13\u680f<br \/>\nLinuxC\/CMySQL\u9762\u8bd5\u9898Redis<br \/>\n\u4e00\u3001ShardingSphere \u5b9a\u4f4d ShardingSphere-Proxy \u5bf9\u5e94\u7528\u5c42\u4f2a\u88c5\u6210\u4e00\u4e2a MySQL \u670d\u52a1&#xff08;\u9ed8\u8ba4\u7aef\u53e3 3307&#xff09;\u3002\u5e94\u7528\u628a\u5b83\u5f53\u6210\u4e00\u4e2a\u666e\u901a MySQL \u8fde\u63a5&#xff0c;SQL \u5168\u90e8\u53d1\u7ed9\u5b83&#xff0c;\u7531\u5b83\u8d1f\u8d23&#xff1a; \u8bfb\u5199\u5206\u79bb\u8def\u7531&#xff1a;\u5199\u8d70\u4e3b\u5e93\u3001\u8bfb\u8d70\u4ece\u5e93&#xff1b;\u5206\u7247\u8def\u7531&#xff1a;\u6309\u5206<\/p>\n","protected":false},"author":2,"featured_media":117674,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[114,100],"topic":[],"class_list":["post-117681","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-mysql","tag-100"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MySQL\u4e4b\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/117681.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL\u4e4b\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"&#x1f4da; \u672c\u6587\u6536\u5f55\u4e8e\u300cbksczm\u300d\u7684\u7cfb\u5217\u4e13\u680f LinuxC\/CMySQL\u9762\u8bd5\u9898Redis \u4e00\u3001ShardingSphere \u5b9a\u4f4d ShardingSphere-Proxy \u5bf9\u5e94\u7528\u5c42\u4f2a\u88c5\u6210\u4e00\u4e2a MySQL \u670d\u52a1&#xff08;\u9ed8\u8ba4\u7aef\u53e3 3307&#xff09;\u3002\u5e94\u7528\u628a\u5b83\u5f53\u6210\u4e00\u4e2a\u666e\u901a MySQL \u8fde\u63a5&#xff0c;SQL \u5168\u90e8\u53d1\u7ed9\u5b83&#xff0c;\u7531\u5b83\u8d1f\u8d23&#xff1a; \u8bfb\u5199\u5206\u79bb\u8def\u7531&#xff1a;\u5199\u8d70\u4e3b\u5e93\u3001\u8bfb\u8d70\u4ece\u5e93&#xff1b;\u5206\u7247\u8def\u7531&#xff1a;\u6309\u5206\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/117681.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-24T21:56:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261024215637-6add2995135fb.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/117681.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/117681.html\",\"name\":\"MySQL\u4e4b\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-24T21:56:42+00:00\",\"dateModified\":\"2026-10-24T21:56:42+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/117681.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/117681.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/117681.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL\u4e4b\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL\u4e4b\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/117681.html","og_locale":"zh_CN","og_type":"article","og_title":"MySQL\u4e4b\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"&#x1f4da; \u672c\u6587\u6536\u5f55\u4e8e\u300cbksczm\u300d\u7684\u7cfb\u5217\u4e13\u680f LinuxC\/CMySQL\u9762\u8bd5\u9898Redis \u4e00\u3001ShardingSphere \u5b9a\u4f4d ShardingSphere-Proxy \u5bf9\u5e94\u7528\u5c42\u4f2a\u88c5\u6210\u4e00\u4e2a MySQL \u670d\u52a1&#xff08;\u9ed8\u8ba4\u7aef\u53e3 3307&#xff09;\u3002\u5e94\u7528\u628a\u5b83\u5f53\u6210\u4e00\u4e2a\u666e\u901a MySQL \u8fde\u63a5&#xff0c;SQL \u5168\u90e8\u53d1\u7ed9\u5b83&#xff0c;\u7531\u5b83\u8d1f\u8d23&#xff1a; \u8bfb\u5199\u5206\u79bb\u8def\u7531&#xff1a;\u5199\u8d70\u4e3b\u5e93\u3001\u8bfb\u8d70\u4ece\u5e93&#xff1b;\u5206\u7247\u8def\u7531&#xff1a;\u6309\u5206","og_url":"https:\/\/www.wsisp.com\/helps\/117681.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-24T21:56:42+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261024215637-6add2995135fb.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/117681.html","url":"https:\/\/www.wsisp.com\/helps\/117681.html","name":"MySQL\u4e4b\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-24T21:56:42+00:00","dateModified":"2026-10-24T21:56:42+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/117681.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/117681.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/117681.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"MySQL\u4e4b\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/117681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=117681"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/117681\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/117674"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=117681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=117681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=117681"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=117681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}