{"id":10008406,"date":"2024-02-26T23:53:37","date_gmt":"2024-02-26T15:53:37","guid":{"rendered":"https:\/\/blog.itmax.cn\/?p=10008406"},"modified":"2024-02-26T23:53:37","modified_gmt":"2024-02-26T15:53:37","slug":"%e5%88%86%e5%ba%93%e5%88%86%e8%a1%a8%e5%a6%82%e4%bd%95%e7%ae%a1%e7%90%86%e4%b8%8d%e5%90%8c%e5%ae%9e%e4%be%8b%e4%b8%ad%e5%87%a0%e4%b8%87%e5%bc%a0%e5%88%86%e7%89%87%e8%a1%a8%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008406","title":{"rendered":"\u5206\u5e93\u5206\u8868\u5982\u4f55\u7ba1\u7406\u4e0d\u540c\u5b9e\u4f8b\u4e2d\u51e0\u4e07\u5f20\u5206\u7247\u8868\uff1f"},"content":{"rendered":"<p><strong>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u5c0f\u5bcc\uff5e<\/strong><\/p>\n<p><strong>ShardingSphere\u5b9e\u73b0\u5206\u5e93\u5206\u8868\uff0c\u5982\u4f55\u7ba1\u7406\u5206\u5e03\u5728\u4e0d\u540c\u6570\u636e\u5e93\u5b9e\u4f8b\u4e2d\u7684\u6210\u5343\u4e0a\u4e07\u5f20\u5206\u7247\u8868\uff1f<\/strong><\/p>\n<p>\u4e0a\u8fb9\u7684\u95ee\u9898\u662f\u4e4b\u524d\u6709\u4e2a\u5c0f\u4f19\u4f34\u770b\u4e86\u6211\u7684\u5206\u5e93\u5206\u8868\u7684\u6587\u7ae0\uff0c\u79c1\u4e0b\u54a8\u8be2\u6211\u7684\uff0c\u770b\u5230\u4ed6\u7684\u63d0\u95ee\u6211\u7b2c\u4e00\u611f\u89c9\u5c31\u662f\u8fd9\u8001\u94c1\u6ca1\u7528\u8fc7ShardingSphere\uff0c\u56e0\u4e3a\u8fd9\u4e2a\u95ee\u9898\u5728ShardingSphere\u4e2d\u5df2\u7ecf\u6709\u4e86\u5f88\u597d\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u63a5\u4e0b\u6765\u770b\u770b\u600e\u4e48\u5b9e\u73b0\u3002<\/p>\n<blockquote><p>\u672c\u6587\u6848\u4f8b\u4ee3\u7801<strong>GitHub<\/strong>\u5730\u5740\uff1a<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=30c%2FzRqBxrj81cviGSfIgA%3D%3D.iAltEI%2FzkYraEQUpG5cIDf8d56%2BSw3w8abJmWn9cBjMYuJLZpT9YkMgg0G5%2FTLpx53X%2Bjn5MPlYoenyWx9Wl6BUe%2BvHUY0PDEPooq4XQnhpX2KBpdbZkfBYzB8r%2BQ6CVAnN4E22dQZr%2BWvmYMyMjvf%2F8Hjf7lOEjrIvArRbq5QA%3D\" rel=\"noopener noreferrer\">https:\/\/github.com\/chengxy-nds\/Springboot-Notebook\/tree\/master\/shardingsphere101\/shardingsphere-autocreate-table<\/a><\/p><\/blockquote>\n<h2>\u7cfb\u5217\u5f80\u671f<\/h2>\n<p>\u5f80\u671f\u7cfb\u5217\u6587\u7ae0\uff08\u6211\u4f5b\u7cfb\u66f4\u65b0\uff0c\u65e0\u4e0b\u9650\u62d6\u66f4\uff09\uff1a<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=fIbg1z8MJaCDo%2BbGNYf0AA%3D%3D.gqxZ%2FyhEkfJh57pt5%2FhNDIsfIjyYawKFNtl%2FbdmmimurwQOTwAEFluc8DzQoNZUTJBGPISM19ngB%2BpnevZ3bng%3D%3D\" rel=\"noopener noreferrer\">\uff08\u4e00\uff09\u597d\u597d\u7684\u7cfb\u7edf\uff0c\u4e3a\u4ec0\u4e48\u8981\u5206\u5e93\u5206\u8868\uff1f<\/a><\/p>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=AyXFdZRI4PETBfBNCsLkIQ%3D%3D.sU%2FtC2Q03fHsSGPkC0HwP6abYaO1Fd9CDSKEUQUatmRkfZkdfljVU%2FLRBfDjRr%2BTQPkpiN%2FMAvb3kVZvt1PTCQ%3D%3D\" rel=\"noopener noreferrer\">\uff08\u4e8c\uff09\u5206\u5e93\u5206\u8868\u7684 21 \u6761\u6cd5\u5219\uff0chold \u4f4f\uff01<\/a><\/p>\n<p><a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=zmrDm4KWoPR8sbAc8IT8DQ%3D%3D.QYcRp1NNdGLxvVXJUsLctNIL8GmpBSF6WNtrA5EhY7n8UTOWjVGrJ%2Fn%2FXOoiytsWChDuCZFyKPXD%2FPprYJfiQA%3D%3D\" rel=\"noopener noreferrer\">\uff08\u4e09\uff092 \u79cd\u65b9\u5f0f\u5feb\u901f\u5b9e\u73b0\u5206\u5e93\u5206\u8868\uff0c\u8f7b\u677e\u62ff\u634f\uff01<\/a><\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043952561\" alt=\"ShardingSphere\u5b66\u4e60\u8def\u7ebf\" title=\"ShardingSphere\u5b66\u4e60\u8def\u7ebf\"><\/p>\n<p>\u672c\u6587\u662f\u300aShardingSphere5.x\u5206\u5e93\u5206\u8868\u539f\u7406\u4e0e\u5b9e\u6218\u300b\u7cfb\u5217\u7684\u7b2c\u56db\u7bc7\u6587\u7ae0\uff0c\u5728\u8fdb\u884c\u5206\u5e93\u5206\u8868\u8bbe\u8ba1\u65f6\uff0c\u786e\u8ba4\u597d\u4e86\u6570\u636e\u8282\u70b9\u6570\u91cf\u548c\u5206\u7247\u7b56\u7565\u4ee5\u540e\uff0c\u63a5\u4e0b\u6765\u8981\u505a\u7684\u5c31\u662f\u7ba1\u7406\u5927\u91cf\u7684\u5206\u7247\u8868\u3002\u5b9e\u9645\u5b9e\u65bd\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u5b58\u5728\u4e0a\u767e\u4e2a\u5206\u7247\u6570\u636e\u5e93\u5b9e\u4f8b\uff0c\u6bcf\u4e2a\u5b9e\u4f8b\u4e2d\u90fd\u53ef\u80fd\u6709\u6210\u5343\u4e0a\u4e07\u4e2a\u5206\u7247\u8868\uff0c\u5982\u679c\u4ec5\u4f9d\u9760\u4eba\u529b\u6765\u5b8c\u6210\u8fd9\u4e9b\u4efb\u52a1\u663e\u7136\u662f\u4e0d\u73b0\u5b9e\u7684\u3002\u6240\u4ee5\uff0c\u60f3\u8981\u5feb\u901f\u4e14\u81ea\u52a8\u5316\u7ba1\u7406\u8fd9\u4e9b\u5206\u7247\u8868\uff0c\u4f7f\u7528\u5de5\u5177\u662f\u5341\u5206\u5fc5\u8981\u6ef4\u3002<\/p>\n<h2>\u524d\u8a00<\/h2>\n<p><code>ShardingSphere<\/code>\u6846\u67b6\u6210\u5458\u4e2d\u7684<code>Shardingsphere-jdbc<\/code>\u548c<code>Shardingsphere-proxy<\/code>\u90fd\u63d0\u4f9b\u4e86\u81ea\u52a8\u5316\u7ba1\u7406\u5206\u7247\u8868\u7684\u529f\u80fd<code>auto-tables<\/code>\uff0c\u53ef\u4ee5\u7edf\u4e00\u7ef4\u62a4\u5927\u91cf\u7684\u5206\u7247\u8868\uff0c\u907f\u514d\u4e86\u624b\u52a8\u7f16\u5199\u811a\u672c\u548c\u7ef4\u62a4\u5206\u7247\u8868\u7684\u7e41\u7410\u5de5\u4f5c\uff0c\u6781\u5927\u7a0b\u5ea6\u51cf\u5c11\u5206\u5e93\u5206\u8868\u7684\u5f00\u53d1\u548c\u7ef4\u62a4\u6210\u672c\uff0c\u63d0\u5347\u6548\u7387\u548c\u53ef\u9760\u6027\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044658663\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u91cc\u54b1\u4eec\u5148\u4f7f\u7528<code>Shardingsphere-jdbc<\/code>\u6765\u5b9e\u9645\u64cd\u4f5c\u4e00\u4e0b\uff0c<code>Shardingsphere-proxy<\/code>\u65b9\u5f0f\u540e\u7eed\u4f1a\u6709\u5355\u72ec\u7684\u6587\u7ae0\u8be6\u7ec6\u8bb2\u89e3\uff0c\u5c31\u4e0d\u5728\u8fd9\u91cc\u5c55\u5f00\u4e86\u3002<\/p>\n<h2>\u51c6\u5907\u5de5\u4f5c<\/h2>\n<p>\u5047\u8bbe\u6211\u4eec\u8981\u5bf9<code>t_order<\/code>\u8868\u8fdb\u884c\u5206\u5e93\u5206\u8868\uff0c\u9996\u5148\u6211\u4eec\u8981\u505a\u7684\u5c31\u662f\u786e\u5b9a\u597d\u5206\u7247\u65b9\u6848\uff0c\u8fd9\u91cc\u4f7f\u7528\u4e24\u4e2a\u6570\u636e\u5e93\u5b9e\u4f8b<code>db0<\/code>\u3001<code>db1<\/code>\uff0c\u6bcf\u4e2a\u5b9e\u4f8b\u4e2d<code>t_order<\/code>\u8868\u5206\u62101000\u5f20\u5206\u7247\u8868<code>t_order_1 ~ t_order_1000<\/code>\uff0c<code>order_id<\/code>\u5b57\u6bb5\u4f5c\u4e3a\u5206\u7247\u952e\uff0c\u5206\u7247\u7b97\u6cd5\u4f7f\u7528\u53d6\u6a21\u7b97\u6cd5<code>order_id % n<\/code>\uff0c\u5206\u5e03\u5f0f\u4e3b\u952e\u751f\u6210\u7b56\u7565\u91c7\u7528<code>snowflake<\/code>\u3002<\/p>\n<p><code>t_order<\/code>\u903b\u8f91\u8868\u7684\u8868\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"sql\">CREATE TABLE `t_order` (\n    `order_id` BIGINT ( 20 ) NOT NULL COMMENT &quot;\u8ba2\u5355\u8868\u5206\u5e03\u5f0f\u4e3b\u5065ID&quot;,\n    `order_number` VARCHAR ( 255 ) NOT NULL COMMENT &quot;\u8ba2\u5355\u53f7&quot;,\n    `customer_id` BIGINT ( 20 ) NOT NULL COMMENT &quot;\u7528\u6237ID&quot;,\n    `order_date` date NOT NULL COMMENT &quot;\u4e0b\u5355\u65f6\u95f4&quot;,\n    `total_amount` DECIMAL ( 10, 2 ) NOT NULL COMMENT &quot;\u8ba2\u5355\u91d1\u989d&quot;,\n    PRIMARY KEY ( `order_id` ) USING BTREE \n);<\/code><\/pre>\n<p>\u6709\u4e86\u8fd9\u4e9b\u57fa\u7840\u4fe1\u606f\uff0c\u53ef\u4ee5\u5148\u6765\u8fdb\u884c<code>t_order<\/code>\u8868\u7684\u5206\u7247\u914d\u7f6e\u4e86\uff0c\u4e0d\u8003\u8651\u5176\u4ed6\u56e0\u7d20\uff0c\u8fd9\u91cc\u5148<strong>Run<\/strong>\u8d77\u6765\uff01<\/p>\n<h2>\u5206\u7247\u89c4\u5219\u914d\u7f6e<\/h2>\n<p>\u8bbe\u5b9a\u597d\u5206\u7247\u89c4\u5219\uff0c\u63a5\u7740\u7f16\u5199\u903b\u8f91\u8868<code>t_order<\/code>\u7684\u5206\u7247\u89c4\u5219\u7684\u914d\u7f6e\uff0c\u6211\u5206\u522b\u4f7f\u7528<code>yml\u914d\u7f6e<\/code>\u548c<code>Java\u7f16\u7801<\/code>\u4e24\u79cd\u65b9\u5f0f\u505a\u4e86\u5b9e\u73b0\u3002<strong>\u8981\u6ce8\u610f\u7684\u662f\u4e24\u79cd\u65b9\u5f0f\u4e0d\u8981\u5e76\u5b58\uff0c\u4e0d\u7136\u542f\u52a8\u4f1a\u62a5\u9519<\/strong>\u3002<\/p>\n<h3>yml\u914d\u7f6e\u65b9\u5f0f<\/h3>\n<p>\u4f7f\u7528yml\u914d\u7f6e\u76f8\u5bf9\u7b80\u5355\u6613\u7528\u6bd4\u8f83\u76f4\u89c2\uff0c\u9002\u5408\u5bf9\u5206\u5e93\u5206\u8868\u8981\u6c42\u4e0d\u592a\u590d\u6742\u7684\u573a\u666f\uff0c\u5b8c\u6574\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"yml\">spring:\n  shardingsphere:\n    datasource:\n      # \u6570\u636e\u6e90\u540d\u79f0\uff0c\u591a\u6570\u636e\u6e90\u4ee5\u9017\u53f7\u5206\u9694 ,\u653e\u5728\u7b2c\u4e00\u4e2a\u7684\u6570\u636e\u6e90\u4e3a\u672a\u914d\u7f6e\u5206\u7247\u89c4\u5219\u8868\u7684\u9ed8\u8ba4\u6570\u636e\u6e90\n      names: db0 , db1\n      # \u540d\u79f0\u4e0e\u4e0a\u8fb9 names \u4fdd\u6301\u4e00\u81f4\n      db0:\n      ....\n\n      db1:\n      ....\n    # \u5177\u4f53\u89c4\u5219\u914d\u7f6e\n    rules:\n      sharding:\n        # \u5206\u7247\u7b97\u6cd5\u5b9a\u4e49\n        sharding-algorithms:\n          # \u81ea\u5b9a\u4e49\u5206\u7247\u7b97\u6cd5\u540d\u79f0\n          t_order_database_algorithms:\n            # \u5206\u7247\u7b97\u6cd5\u7c7b\u578b\n            type: INLINE\n            # \u81ea\u5b9a\u4e49\u53c2\u6570\n            props:\n              algorithm-expression: db$-&gt;{order_id % 2}\n          t_order_table_algorithms:\n            type: INLINE\n            props:\n              algorithm-expression: t_order_$-&gt;{order_id % 1000}\n          t_order_mod:\n            type: MOD\n            props:\n              # \u6307\u5b9a\u5206\u7247\u6570\u91cf\n              sharding-count: 1000\n        # \u5206\u5e03\u5f0f\u5e8f\u5217\u7b97\u6cd5\u914d\u7f6e\n        key-generators:\n          t_order_snowflake:\n            type: SNOWFLAKE\n            # \u5206\u5e03\u5f0f\u5e8f\u5217\u7b97\u6cd5\u5c5e\u6027\u914d\u7f6e\n            props:\n              worker-id: 1\n        tables:\n          # \u903b\u8f91\u8868\u540d\u79f0\n          t_order:\n            # \u6570\u636e\u8282\u70b9\uff1a\u6570\u636e\u5e93.\u5206\u7247\u8868\n            actual-data-nodes: db$-&gt;{0..1}.t_order_$-&gt;{1..1000}\n            # \u5206\u5e93\u7b56\u7565\n            database-strategy:\n              standard:\n                # \u5206\u7247\u5217\u540d\u79f0\n                sharding-column: order_id\n                # \u5206\u7247\u7b97\u6cd5\u540d\u79f0\n                sharding-algorithm-name: t_order_database_algorithms\n            # \u5206\u8868\u7b56\u7565\n            table-strategy:\n              standard:\n                # \u5206\u7247\u5217\u540d\u79f0\n                sharding-column: order_id\n                # \u5206\u7247\u7b97\u6cd5\u540d\u79f0\n                sharding-algorithm-name: t_order_table_algorithms\n            # \u4e3b\u952e\u751f\u6210\u7b56\u7565\n            keyGenerateStrategy:\n              column: order_id\n              keyGeneratorName: t_order_snowflake\n    # \u5c5e\u6027\u914d\u7f6e\n    props:\n      # \u5c55\u793a\u4fee\u6539\u4ee5\u540e\u7684sql\u8bed\u53e5\n      sql-show: true<\/code><\/pre>\n<h3>Java\u7f16\u7801\u65b9\u5f0f<\/h3>\n<p>\u4f7f\u7528Java\u7f16\u7801\u65b9\u5f0f\u66f4\u52a0\u7075\u6d3b\u548c\u53ef\u6269\u5c55\uff0c\u53ef\u4ee5\u6839\u636e\u4e1a\u52a1\u5b9a\u5236\u5206\u7247\u89c4\u5219\uff0c\u9002\u5408\u5bf9\u5206\u5e93\u5206\u8868\u6709\u7279\u6b8a\u9700\u6c42\u6216\u9700\u8981\u52a8\u6001\u8c03\u6574\u7684\u573a\u666f\u3002<\/p>\n<pre><code class=\"java\">\/**\n * \u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc\n *\/\n@Configuration\npublic class ShardingConfiguration {\n\n    \/**\n     * \u914d\u7f6e\u5206\u7247\u6570\u636e\u6e90\n     * \u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc\n     *\/\n    @Bean\n    public DataSource getShardingDataSource() throws SQLException {\n        Map&lt;String, DataSource&gt; dataSourceMap = new HashMap&lt;&gt;();\n        dataSourceMap.put(&quot;db0&quot;, dataSource0());\n        dataSourceMap.put(&quot;db1&quot;, dataSource1());\n\n        \/\/ \u5206\u7247rules\u89c4\u5219\u914d\u7f6e\n        ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();\n\n        \/\/ \u5206\u7247\u7b97\u6cd5\n        shardingRuleConfig.setShardingAlgorithms(getShardingAlgorithms());\n        \/\/ \u914d\u7f6e t_order \u8868\u5206\u7247\u89c4\u5219\n        ShardingTableRuleConfiguration orderTableRuleConfig = new ShardingTableRuleConfiguration(&quot;t_order&quot;, &quot;db${0..1}.t_order_${1..1000}&quot;);\n        orderTableRuleConfig.setTableShardingStrategy(new StandardShardingStrategyConfiguration(&quot;order_id&quot;, &quot;t_order_table_algorithms&quot;));\n        orderTableRuleConfig.setDatabaseShardingStrategy(new StandardShardingStrategyConfiguration(&quot;order_id&quot;, &quot;t_order_database_algorithms&quot;));\n        shardingRuleConfig.getTables().add(orderTableRuleConfig);\n\n        \/\/ \u662f\u5426\u5728\u63a7\u5236\u53f0\u8f93\u51fa\u89e3\u6790\u6539\u9020\u540e\u771f\u5b9e\u6267\u884c\u7684 SQL\n        Properties properties = new Properties();\n        properties.setProperty(&quot;sql-show&quot;, &quot;true&quot;);\n\n        \/\/ \u521b\u5efa ShardingSphere \u6570\u636e\u6e90\n        return ShardingSphereDataSourceFactory.createDataSource(dataSourceMap, Collections.singleton(shardingRuleConfig), properties);\n    }\n\n    \/**\n     * \u914d\u7f6e\u6570\u636e\u6e901\n     * \u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc\n     *\/\n    public DataSource dataSource0() {\n        HikariDataSource dataSource = new HikariDataSource();\n        dataSource.setDriverClassName(&quot;com.mysql.cj.jdbc.Driver&quot;);\n        dataSource.setJdbcUrl(&quot;jdbc:mysql:\/\/127.0.0.1:3306\/db0?useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=false&amp;serverTimezone=Asia\/Shanghai&amp;allowPublicKeyRetrieval=true&quot;);\n        dataSource.setUsername(&quot;root&quot;);\n        dataSource.setPassword(&quot;123456&quot;);\n        return dataSource;\n    }\n\n    \/**\n     * \u914d\u7f6e\u6570\u636e\u6e902\n     * \u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc\n     *\/\n    public DataSource dataSource1() {\n        HikariDataSource dataSource = new HikariDataSource();\n        dataSource.setDriverClassName(&quot;com.mysql.cj.jdbc.Driver&quot;);\n        dataSource.setJdbcUrl(&quot;jdbc:mysql:\/\/127.0.0.1:3306\/db1?useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=false&amp;serverTimezone=Asia\/Shanghai&amp;allowPublicKeyRetrieval=true&quot;);\n        dataSource.setUsername(&quot;root&quot;);\n        dataSource.setPassword(&quot;123456&quot;);\n        return dataSource;\n    }\n\n    \/**\n     * \u914d\u7f6e\u5206\u7247\u7b97\u6cd5\n     * \u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc\n     *\/\n    private Map&lt;String, AlgorithmConfiguration&gt; getShardingAlgorithms() {\n        Map&lt;String, AlgorithmConfiguration&gt; shardingAlgorithms = new LinkedHashMap&lt;&gt;();\n\n        \/\/ \u81ea\u5b9a\u4e49\u5206\u5e93\u7b97\u6cd5\n        Properties databaseAlgorithms = new Properties();\n        databaseAlgorithms.setProperty(&quot;algorithm-expression&quot;, &quot;db$-&gt;{order_id % 2}&quot;);\n        shardingAlgorithms.put(&quot;t_order_database_algorithms&quot;, new AlgorithmConfiguration(&quot;INLINE&quot;, databaseAlgorithms));\n\n        \/\/ \u81ea\u5b9a\u4e49\u5206\u8868\u7b97\u6cd5\n        Properties tableAlgorithms = new Properties();\n        tableAlgorithms.setProperty(&quot;algorithm-expression&quot;, &quot;db$-&gt;{order_id % 1000}&quot;);\n        shardingAlgorithms.put(&quot;t_order_table_algorithms&quot;, new AlgorithmConfiguration(&quot;INLINE&quot;, tableAlgorithms));\n\n        return shardingAlgorithms;\n    }\n}\n<\/code><\/pre>\n<p>\u4e0a\u9762\u6211\u4eec\u5728\u5e94\u7528\u4e2d\u7f16\u5199\u597d\u4e86\u5206\u7247\u89c4\u5219\uff0c\u73b0\u5728\u5c31\u5dee\u5728\u6570\u636e\u5e93\u5b9e\u4f8b\u4e2d\u521b\u5efa\u5206\u7247\u8868\u4e86\uff0c\u624b\u52a8\u521b\u5efa\u548c\u7ba1\u74061000\u5f20\u5206\u7247\u8868\u786e\u5b9e\u662f\u4e00\u4e2a\u53c8\u810f\u53c8\u7d2f\u7684\u6d3b\uff0c\u53cd\u6b63\u6211\u662f\u4e0d\u4f1a\u5e72\u7684\uff01<\/p>\n<h2>\u7ba1\u7406\u5206\u7247\u8868<\/h2>\n<p>\u5176\u5b9e\uff0c<code>ShardingSphere<\/code>\u5185\u5df2\u7ecf\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u7ba1\u7406\u5206\u7247\u8868\u7684\u80fd\u529b\u3002<\/p>\n<p>\u5f53\u4e00\u5f20\u903b\u8f91\u8868<code>t_order<\/code>\u88ab\u914d\u7f6e\u4e86\u5206\u7247\u89c4\u5219\uff0c\u90a3\u4e48\u63a5\u4e0b\u6765\u5bf9\u903b\u8f91\u8868\u7684\u5404\u79cd<code>DDL<\/code>\u64cd\u4f5c\uff08\u4f8b\u5982<code>\u521b\u5efa\u8868<\/code>\u3001<code>\u4fee\u6539\u8868\u7ed3\u6784<\/code>\u7b49\uff09\uff0c\u547d\u4ee4\u548c\u6570\u636e\u4f1a\u6839\u636e\u5206\u7247\u89c4\u5219\uff0c\u6267\u884c\u548c\u5b58\u50a8\u5230\u6bcf\u4e2a\u5206\u7247\u6570\u636e\u5e93\u548c\u5206\u7247\u5e93\u4e2d\u7684\u76f8\u5e94\u5206\u7247\u8868\u4e2d\uff0c\u4ee5\u6b64\u4fdd\u6301\u6574\u4e2a\u5206\u7247\u73af\u5883\u7684\u4e00\u81f4\u6027\u3002<\/p>\n<p>\u4e0d\u8fc7\uff0c\u4f7f\u7528<code>Shardingsphere-jdbc<\/code>\u7ba1\u7406\u5206\u7247\u8868\u7684\u8fc7\u7a0b\u4e2d\uff0c\u662f\u9700\u8981\u6211\u4eec\u624b\u52a8\u7f16\u5199\u5bf9\u903b\u8f91\u8868\u7684<code>DDL<\/code>\u64cd\u4f5c\u7684\u4ee3\u7801\u3002\u6211\u4eec\u6765\u8dd1\u51e0\u4e2a\u5355\u5143\u6d4b\u8bd5\u7528\u4f8b\u6765\u89c2\u5bdf\u5b9e\u9645\u7684\u6267\u884c\u6548\u679c\uff0c\u76f4\u63a5\u4f7f\u7528<code>jdbcTemplate<\/code>\u6267\u884c\u521b\u5efa\u903b\u8f91\u8868<code>t_order<\/code>\u7684SQL\u3002<\/p>\n<pre><code class=\"java\">\/**\n * @author \u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc\n * \u81ea\u52a8\u521b\u5efa\u5206\u7247\u8868\n * @date 2023\/12\/31 17:25\n *\/\n@SpringBootTest\nclass AutoCreateTablesTests {\n    @Resource\n    private JdbcTemplate jdbcTemplate;\n    \/**\n     * \u6267\u884c\u521b\u5efa\u903b\u8f91\u8868\u7684SQL\uff0c\u4f1a\u6839\u636eAutoTables\u7684\u914d\u7f6e\u81ea\u52a8\u5728\u5bf9\u5e94\u7684\u6570\u636e\u6e90\u5185\u521b\u5efa\u5206\u7247\u8868\n     * @author \u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc\n     *\/\n    @Test\n    public void autoCreateOrderTableTest() {\n\n        jdbcTemplate.execute(&quot;CREATE TABLE `t_order` (\/n&quot; +\n                &quot;  `order_id` bigint(20) NOT NULL,\/n&quot; +\n                &quot;  `order_number` varchar(255) NOT NULL,\/n&quot; +\n                &quot;  `customer_id` bigint(20) NOT NULL,\/n&quot; +\n                &quot;  `order_date` date NOT NULL,\/n&quot; +\n                &quot;  `total_amount` decimal(10,2) NOT NULL,\/n&quot; +\n                &quot;  PRIMARY KEY (`order_id`) USING BTREE\/n&quot; +\n                &quot;);&quot;);\n    }\n}<\/code><\/pre>\n<p>\u6839\u636e\u4e4b\u524d\u914d\u7f6e\u7684\u5206\u7247\u89c4\u5219\uff0c\u5c06\u4f1a\u5728\u4e24\u4e2a\u6570\u636e\u5e93\u5b9e\u4f8b <code>db0<\/code> \u548c <code>db1<\/code> \u4e2d\uff0c\u5206\u522b\u751f\u6210<code>1000<\/code>\u5f20\u547d\u540d\u4e3a<code>t_order_1<\/code>\u5230<code>t_order_1000<\/code>\u7684\u5206\u7247\u8868\uff0c\u770b\u5230\u4e24\u4e2a\u6570\u636e\u5e93\u5747\u6210\u529f\u521b\u5efa\u4e861000\u5f20\u5206\u7247\u8868\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044658664\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5728\u6b21\u6267\u884c\u66f4\u65b0<code>t_order<\/code>\u8868SQL\uff0c\u5c06\u5b57\u6bb5<code>order_number<\/code>\u957f\u5ea6\u4ece <code>varchar(255)<\/code>\u6269\u5c55\u5230 <code>varchar(500)<\/code>\uff0c\u6267\u884cSQL\u770b\u4e0b\u6548\u679c\u3002<\/p>\n<pre><code class=\"java\">\/**\n * @author \u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u5c0f\u5bcc\n * \u81ea\u52a8\u521b\u5efa\u5206\u7247\u8868\n * @date 2023\/12\/31 17:25\n *\/\n@SpringBootTest\nclass AutoCreateTablesTests {\n    @Resource\n    private JdbcTemplate jdbcTemplate;\n    \n    @Test\n    public void autoModifyOrderTableTest() {\n\n        jdbcTemplate.execute(&quot;ALTER TABLE t_order MODIFY COLUMN order_number varchar(500);&quot;);\n    }\n}<\/code><\/pre>\n<p>\u901a\u8fc7\u67e5\u770b\u4e24\u4e2a\u5206\u7247\u5e93\uff0c\u6211\u4eec\u6210\u529f\u5730\u5c06\u6240\u6709\u5206\u7247\u8868\u7684<code>order_number<\/code>\u5b57\u6bb5\u957f\u5ea6\u66f4\u6539\u4e3a\u4e86<code>varchar(500)<\/code>\uff0c\u5728\u63a7\u5236\u53f0\u65e5\u5fd7\u4e2d\uff0c\u53ef\u4ee5\u770b\u5230\u5b83\u662f\u901a\u8fc7\u5728\u6bcf\u4e2a\u5206\u7247\u5e93\u5185\u4f9d\u6b21\u6267\u884c\u4e861000\u6b21\u547d\u4ee4\u5b9e\u73b0\u7684\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044658665\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><code>Shardingsphere-jdbc<\/code>\u5b9e\u73b0\u5206\u5e93\u5206\u8868\u65f6\uff0c\u53ef\u4ee5\u91c7\u7528\u8fd9\u79cd\u9ed8\u8ba4\u7684\u65b9\u5f0f\u6765\u7ba1\u7406\u5206\u7247\u8868\u3002\u4f46\u8981\u6ce8\u610f\u7684\u662f\uff0c\u7531\u4e8e\u6d89\u53ca\u5230\u4e0d\u540c\u7684\u6570\u636e\u5e93\u5b9e\u4f8b\uff0c\u5982\u679c\u4e0d\u4f7f\u7528\u7b2c\u4e09\u65b9\u7684\u5206\u5e03\u5f0f\u4e8b\u52a1\u7ba1\u7406\u5de5\u5177\uff08\u4f8b\u5982<code>Seata<\/code>\u7b49\uff09\uff0c\u6267\u884c\u8fc7\u7a0b\u662f\u65e0\u6cd5\u4fdd\u8bc1\u4e8b\u52a1\u4e00\u81f4\u6027\u7684\u3002<\/p>\n<h2>\u81ea\u5b9a\u4e49\u7ba1\u7406\u5206\u7247\u8868<\/h2>\n<p>\u4e0a\u8fb9\u4e3a\u903b\u8f91\u8868\u914d\u7f6e\u5206\u7247\u89c4\u5219\uff0c\u5e94\u7528\u7a0b\u5e8f\u5185\u6267\u884c\u5bf9\u903b\u8f91\u8868\u7684DDL\u64cd\u4f5c\uff0c\u5c31\u53ef\u4ee5\u5f88\u8f7b\u677e\u7684\u7ba1\u7406\u5206\u7247\u8868\u3002<\/p>\n<h3>\u81ea\u5b9a\u4e49<\/h3>\n<p>\u4e0d\u8fc7\uff0c\u9ed8\u8ba4\u7684\u5206\u7247\u7ba1\u7406\u8fd8\u662f\u6709\u5c40\u9650\u6027\u7684\uff0c\u6211\u4eec\u5728\u8bbe\u8ba1\u5206\u7247\u89c4\u5219\u65f6\u5f80\u5f80\u4f1a\u6839\u636e\u4e0d\u540c\u7684\u4e1a\u52a1\u7ef4\u5ea6\u6765\u5212\u5206\uff0c\u4f8b\u5982\u6309\u5929\u3001\u6708\u3001\u6309\u5b63\u5ea6\u751f\u6210\u5206\u7247\u8868\u5e76\u5206\u5e03\u5230\u4e0d\u540c\u6570\u636e\u6e90\u4e2d\u7b49\u3002\u8fd9\u6837\u5c31\u9700\u8981\u4e00\u4e9b\u81ea\u5b9a\u4e49\u7684\u89c4\u5219\u6765\u5b9e\u73b0\u3002<\/p>\n<p><code>ShardingSphere 5.X<\/code>\u7248\u672c\u540e\u63a8\u51fa\u4e86\u4e00\u79cd\u65b0\u7684\u7ba1\u7406\u5206\u7247\u914d\u7f6e\u65b9\u5f0f\uff1a<code>AutoTable<\/code>\u3002\u8bbe\u7f6e\u4e86<code>AutoTable<\/code>\u7684\u903b\u8f91\u8868\uff0c\u5c06\u4ea4\u7531<code>ShardingSphere<\/code>\u81ea\u52a8\u7ba1\u7406\u5206\u7247\uff0c\u7528\u6237\u53ea\u9700\u8981\u6307\u5b9a\u5206\u7247\u6570\u91cf\u548c\u4f7f\u7528\u7684\u6570\u636e\u5e93\u5b9e\u4f8b\uff0c\u65e0\u9700\u518d\u5173\u5fc3\u8868\u7684\u5177\u4f53\u5206\u5e03\uff0c\u914d\u7f6e\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"yaml\">spring:\n  shardingsphere:\n    # \u6570\u636e\u6e90\u914d\u7f6e\n    datasource:\n      ......\n    # \u5177\u4f53\u89c4\u5219\u914d\u7f6e\n    rules:\n      sharding:\n        # \u903b\u8f91\u8868\u5206\u7247\u89c4\u5219\n        tables:\n          # \u903b\u8f91\u8868\u540d\u79f0\n          t_order:\n            .....\n        # \u81ea\u52a8\u5206\u7247\u8868\u89c4\u5219\u914d\u7f6e\n        auto-tables:\n          t_order: # \u903b\u8f91\u8868\u540d\u79f0\n            actual-data-sources: db$-&gt;{0..1}\n            sharding-strategy: # \u5207\u5206\u7b56\u7565\n              standard: # \u7528\u4e8e\u5355\u5206\u7247\u952e\u7684\u6807\u51c6\u5206\u7247\u573a\u666f\n                sharding-column: order_id # \u5206\u7247\u5217\u540d\u79f0\n                sharding-algorithm-name: t_order_mod # \u81ea\u52a8\u5206\u7247\u7b97\u6cd5\u540d\u79f0<\/code><\/pre>\n<p><code>ShardingSphere-Jdbc<\/code>\u4e2d\u914d\u7f6e\u4f7f\u7528<code>auto-tables<\/code>\u4e3b\u8981\u4e24\u4e2a\u53c2\u6570\uff0c<code>actual-data-sources<\/code>\u6307\u5b9a\u6570\u636e\u6e90\u5206\u5e03\uff0c\u7531\u4e8e\u662f\u7ba1\u7406\u5206\u7247\u8868\u6240\u4ee5\u53ea\u9700\u6570\u636e\u6e90\u4fe1\u606f\u5373\u53ef\uff1b<code>sharding-strategy<\/code>\u6307\u5177\u4f53\u91c7\u7528\u4f55\u79cd\u7b97\u6cd5\u6765\u8fdb\u884c\u5206\u7247\u3002<\/p>\n<blockquote><p>\u5bf9\u903b\u8f91\u8868\u7684DDL\u64cd\u4f5c\uff0c\u7cfb\u7edf\u4f1a\u9996\u5148\u68c0\u67e5\u662f\u5426\u914d\u7f6e\u4e86<strong>AutoTable<\/strong>\uff0c\u5982\u679c\u5df2\u914d\u7f6e\uff0c\u5219\u4f18\u5148\u91c7\u7528\u914d\u7f6e\u7684\u89c4\u5219\uff1b\u82e5\u672a\u914d\u7f6e\uff0c\u5219\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7684\u903b\u8f91\u8868\u5206\u7247\u89c4\u5219\u3002<\/p><\/blockquote>\n<p><code>AutoTable<\/code>\u652f\u6301<code>ShardingSphere<\/code>\u5185\u7f6e\u7684\u5168\u90e8\u81ea\u52a8\u5206\u7247\u7b97\u6cd5\uff0c\u6240\u8c13\u81ea\u52a8\u5206\u7247\u7b97\u6cd5\u5c31\u662f\u6839\u636e<code>actualDataSources<\/code>\u8bbe\u7f6e\u7684\u6570\u636e\u6e90\u4fe1\u606f\uff0c\u4f7f\u7528\u5bf9\u5e94\u5185\u7f6e\u7b97\u6cd5\u81ea\u884c\u89e3\u6790\u5904\u7406\u3002<\/p>\n<ul>\n<li>MOD\uff1a\u53d6\u6a21\u5206\u7247\u7b97\u6cd5<\/li>\n<li>HASH_MOD\uff1a\u54c8\u5e0c\u53d6\u6a21\u5206\u7247\u7b97\u6cd5<\/li>\n<li>VOLUME_RANGE\uff1a\u57fa\u4e8e\u5206\u7247\u5bb9\u91cf\u7684\u8303\u56f4\u5206\u7247\u7b97\u6cd5<\/li>\n<li>BOUNDARY_RANGE\uff1a\u57fa\u4e8e\u5206\u7247\u8fb9\u754c\u7684\u8303\u56f4\u5206\u7247\u7b97\u6cd5<\/li>\n<li>AUTO_INTERVAL\uff1a\u81ea\u52a8\u65f6\u95f4\u6bb5\u5206\u7247\u7b97\u6cd5<\/li>\n<\/ul>\n<h3>AutoTable\u4f7f\u7528<\/h3>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u6211\u4eec\u4f7f\u7528\u5185\u7f6e<code>MOD<\/code>\u53d6\u6a21\u7b97\u6cd5\u4f5c\u4e3a<code>AutoTable<\/code>\u7684\u5206\u7247\u7b97\u6cd5\uff0c\u540c\u6837\u662f<code>db0<\/code>\u3001<code>db1<\/code>\u4e24\u4e2a\u5b9e\u4f8b\u4e2d\u5404\u521b\u5efa1000\u5f20\u5206\u7247\u8868\u3002\u90a3\u4e48\u5f53\u5bf9\u903b\u8f91\u8868\u7684DDL\u64cd\u4f5c\u65f6\uff0c<code>ShardingSphere<\/code>\u4f1a\u4f9d\u636e\u5206\u7247\u8868\u7f16\u53f7<code>t_order_0\uff5et_order_1999 % \u6570\u636e\u5e93\u5b9e\u4f8b\u6570<\/code>\u53d6\u6a21\u6765\u786e\u8ba4DDL\u547d\u4ee4\u8def\u7531\u5230\u54ea\u4e2a\u5b9e\u4f8b\u4e2d\u6267\u884c\u3002<\/p>\n<pre><code class=\"yaml\">\nspring:\n  shardingsphere:\n    # \u6570\u636e\u6e90\u914d\u7f6e\n    datasource:\n      .....\n    # \u5177\u4f53\u89c4\u5219\u914d\u7f6e\n    rules:\n      sharding:\n        # \u81ea\u52a8\u5206\u7247\u8868\u89c4\u5219\u914d\u7f6e\n        auto-tables:\n          t_order:\n            actual-data-sources: db$-&gt;{0..1}\n            sharding-strategy:\n              standard:\n                sharding-column: order_date\n                sharding-algorithm-name: t_order_mod\n        # \u5206\u7247\u7b97\u6cd5\u5b9a\u4e49\n        sharding-algorithms:\n          t_order_mod:\n            type: MOD\n            props:\n              # \u6307\u5b9a\u5206\u7247\u6570\u91cf\n              sharding-count: 2000<\/code><\/pre>\n<p>\u8fd8\u662f\u6267\u884c\u521a\u624d\u521b\u5efa\u8868\u7684\u5355\u5143\u6d4b\u8bd5\uff0c\u4f1a\u53d1\u73b0<code>db0<\/code>\u3001<code>db1<\/code>\u4e24\u4e2a\u5b9e\u4f8b\u4e2d\u5df2\u7ecf\u5404\u81ea\u521b\u5efa\u4e861000\u5f20\u5206\u7247\u8868\uff0c\u4f46\u4f60\u4f1a\u53d1\u73b01000\u5f20\u8868\u5df2\u7ecf\u4e0d\u518d\u662f\u6309\u7167\u987a\u5e8f\u521b\u5efa\u7684\u4e86\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044658666\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4e0a\u8fb9\u4f7f\u7528\u7684\u662f\u5185\u7f6e\u81ea\u52a8\u5206\u7247\u7b97\u6cd5\uff0c\u5b83\u5bf9\u4e8e\u6211\u4eec\u6765\u8bf4\u662f\u9ed1\u76d2\uff0c\u63d0\u4f9b\u5b83\u65b9\u4fbf\u6211\u4eec\u62ff\u6765\u5373\u7528\u3002\u4e0d\u8fc7\uff0c\u5982\u679c\u60f3\u8981\u505a\u5230\u66f4\u7ec6\u7c92\u5ea6\u7684\u7ba1\u7406\u5206\u7247\u8868\uff0c\u6700\u597d\u7684\u529e\u6cd5\u5c31\u662f\u81ea\u5b9a\u4e49\u5206\u7247\u7b97\u6cd5\uff0c<strong>\u540e\u7eed\u7ae0\u8282\u4f1a\u4ecb\u7ecd\u6240\u6709\u5185\u7f6e\u5206\u7247\u7b97\u6cd5\u548c\u81ea\u5b9a\u4e49\u5206\u7247\u7b97\u6cd5\u7684\u4f7f\u7528<\/strong>\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u5728\u4f7f\u7528<code>ShardingSphere<\/code>\u5b9e\u73b0\u5206\u5e93\u5206\u8868\u7684\u65f6\u5019\uff0c\u8981\u6452\u5f03<strong>\u5148\u5efa\u8868\u3001\u518d\u914d\u89c4\u5219<\/strong>\u7684\u4f20\u7edf\u601d\u7ef4\uff0c\u8981\u5148\u786e\u5b9a\u89c4\u5219\u5728\u5efa\u8868\uff0c\u7ba1\u7406\u8868\u662f\u4e00\u4ef6\u5f88\u7b80\u5355\u7684\u4e8b\uff0c\u6211\u4eec\u53ea\u8981\u544a\u8bc9<code>ShardingSphere<\/code>\u5206\u7247\u6570\u91cf\u548c\u5206\u5e03\u89c4\u5219\uff0c\u5269\u4e0b\u7684\u5c31\u8ba9\u6846\u67b6\u6765\u5904\u7406\u5c31\u597d\u4e86\u3002<\/p>\n<blockquote><p>\u672c\u6587\u6848\u4f8b\u4ee3\u7801<strong>GitHub<\/strong>\u5730\u5740\uff1a<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=rIqBiiT8sbazXGkjesJPUA%3D%3D.wmGMH46TudFHouNFijSwQumuz68ODXSIIjb2Uwc5jx2bCCP42q5KMF4p9seXGdwti8OimPLSDAYei%2F6%2BdUMc58cSNEonNwgwv7JoZKk3dPFUOcCCQQ4r6pzJ6iNfrGOkXn6UvXLGqZegc95H4DZyB2urDW9DsA8B8BXGZD27%2BIM%3D\" rel=\"noopener noreferrer\">https:\/\/github.com\/chengxy-nds\/Springboot-Notebook\/tree\/master\/shardingsphere101\/shardingsphere-autocreate-table<\/a><\/p><\/blockquote>\n<p><strong>\u6211\u662f\u5c0f\u5bcc\uff5e \u4e0b\u671f\u89c1<\/strong><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000044658661\">https:\/\/segmentfault.com\/a\/1190000044658661<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u5c0f\u5bcc\uff5e ShardingSphere\u5b9e\u73b0\u5206\u5e93\u5206\u8868\uff0c\u5982\u4f55\u7ba1\u7406\u5206\u5e03\u5728\u4e0d\u540c\u6570\u636e\u5e93\u5b9e\u4f8b\u4e2d\u7684\u6210\u5343\u4e0a\u4e07\u5f20\u5206\u7247\u8868 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008406","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008406"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008406\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}