{"id":10354,"date":"2023-06-09T09:45:54","date_gmt":"2023-06-09T01:45:54","guid":{"rendered":"https:\/\/nj.transwarp.cn:8180\/?p=10354"},"modified":"2023-06-09T09:45:40","modified_gmt":"2023-06-09T01:45:40","slug":"tds-%e6%95%b0%e6%8d%ae%e5%8a%a0%e8%bd%bd%e5%8e%9f%e7%90%86","status":"publish","type":"post","link":"https:\/\/kbwp.transwarp.cn\/?p=10354","title":{"rendered":"TDS \u6570\u636e\u52a0\u8f7d\u539f\u7406"},"content":{"rendered":"<h3>\u6982\u8981\u63cf\u8ff0<\/h3>\n<p>\u672c\u6587\u4e3b\u8981\u63cf\u8ff0 TDS \uff082.x\u53ca\u4ee5\u4e0a\u7248\u672c\uff09\u6570\u636e\u52a0\u8f7d\u7684\u57fa\u672c\u539f\u7406\u3002<\/p>\n<h3>\u8be6\u7ec6\u8bf4\u660e<\/h3>\n<h4>Transporter \u6982\u8ff0<\/h4>\n<p>\u4ee5\u4e0b\u7b80\u79f0 Transporter \u4e3a TDT \u3002<\/p>\n<h5>\u5b9a\u4f4d\u4e0e\u53d8\u8fc1<\/h5>\n<p>TDT \u7ec4\u4ef6\u5728\u5f88\u65e9\u7684\u7248\u672c\u5c31\u6709\uff0c\u5728 TDS \u8fd8\u6ca1\u6709\u4ece TDH \u4e2d\u72ec\u7acb\u51fa\u6765\uff08\u7248\u672c\u53f7\u4e3a transwarp-xxx\uff09\u4e00\u76f4\u5230 TDS 1.x\uff0c\u5176\u5b9a\u4f4d\u4e00\u76f4\u90fd\u662f Inceptor \u7684 ETL \u5de5\u5177\uff0c\u5177\u5907\u6570\u636e\u6d41\u3001\u6279\u91cf\u6570\u636e\u6d41\u7b49\u529f\u80fd\u6a21\u5757\u3002<\/p>\n<p>\u5728 TDS 2.x \u65f6\u4ee3\uff0cTDT \u7684\u5b9a\u4f4d\u53d1\u751f\u4e86\u53d8\u5316\uff0c\u4e3b\u8981\u7528\u4e8e ELT \u3002\u6240\u4ee5 2.x \u4ee5\u540e\u7684 TDT \u4e3b\u8981\u4fdd\u7559\u4e86\u6279\u91cf\u6570\u636e\u6d41\u7684\u529f\u80fd\uff0c\u800c\u4e0d\u518d\u4fdd\u7559\u6570\u636e\u6d41\u529f\u80fd\u3002<\/p>\n<h5>ETL \u4e0e ELT<\/h5>\n<p>\u4e0a\u9762\u63d0\u5230\u4e86 TDT \u5728\u4e0d\u540c\u65f6\u671f\u7684\u5b9a\u4f4d\u5206\u522b\u662f ETL \u548c ELT \u3002<\/p>\n<p>\u4ec0\u4e48\u662f ETL \uff1f\u987e\u540d\u601d\u4e49\uff0c\u5b83\u662f\u6307 Extract-Transform-Load \uff0c\u7528\u6765\u63cf\u8ff0\u5c06\u6570\u636e\u4ece\u6e90\u7aef\u7ecf\u8fc7\u62bd\u53d6\u3001\u8f6c\u6362\u548c\u52a0\u8f7d\u81f3\u76ee\u6807\u7aef\u7684\u8fc7\u7a0b\u3002<\/p>\n<p>\u90a3\u4ec0\u4e48\u662f ELT \u5462\uff1f\u7c7b\u63a8\u53ef\u4ee5\u77e5\u9053\u5b83\u662f\u6307 Extract-Load-Transform \uff0c\u5b83\u8ddf ETL \u7684\u533a\u522b\u5728\u4e8e\u5b83\u662f\u5148\u52a0\u8f7d\u518d\u8f6c\u6362\u6570\u636e\u3002\u968f\u7740\u73b0\u4ee3\u6570\u636e\u5b58\u50a8\u7cfb\u7edf\u7684\u8ba1\u7b97\u80fd\u529b\u4e0d\u65ad\u63d0\u9ad8\uff0c\u5728\u8d8a\u6765\u8d8a\u591a\u7684\u573a\u666f\u4e0b\uff0c\u5148\u52a0\u8f7d\u518d\u8f6c\u6362\u4f1a\u66f4\u4e3a\u6709\u6548\uff0c\u8fd9\u4e5f\u662f TDT \u5b9a\u4f4d\u53d1\u751f\u53d8\u8fc1\u7684\u539f\u56e0\u3002<\/p>\n<h5>\u6570\u636e\u6d41\u4e0e\u6279\u91cf\u6570\u636e\u6d41<\/h5>\n<p>\u4e0a\u9762\u63d0\u5230\u5728 1.x \u53ca\u4e4b\u524d\u7248\u672c\u7684 TDT \u4e2d\uff0c\u5176\u5305\u542b\u6570\u636e\u6d41\u548c\u6279\u91cf\u6570\u636e\u6d41\u529f\u80fd\u3002<\/p>\n<p>\u6240\u8c13\u6570\u636e\u6d41\uff0c\u5c31\u662f\u4e00\u6b21\u5c06\u6570\u636e\u62bd\u53d6\u3001\u8f6c\u6362\u3001\u52a0\u8f7d\u5230 Inceptor \u7684\u8fc7\u7a0b\u3002\u6574\u4e2a\u8fc7\u7a0b\u53c8\u5206\u4e3a\u4e24\u4e2a\u9636\u6bb5\uff0c\u5206\u522b\u662f\u7f16\u8bd1\u548c\u8fd0\u884c\u3002\u7f16\u8bd1\u9636\u6bb5\u4e3b\u8981\u662f\u4e00\u4e9b\u51c6\u5907\u5de5\u4f5c\uff0c\u5982\u4e0a\u4f20\u9a71\u52a8\u6587\u4ef6\u3001\u83b7\u53d6\u8868\u7684\u5927\u5c0f\u3001\u786e\u8ba4\u76ee\u6807\u8868\u7684\u5206\u533a\u5206\u6876\u4fe1\u606f\u7b49\uff1b\u8fd0\u884c\u9636\u6bb5\u4e3b\u8981\u662f\u8fd0\u884cSQL\u548c\u76d1\u63a7\u4efb\u52a1\u7684\u72b6\u6001\u3002\u5728 TDT \u7684\u6570\u636e\u6d41\u529f\u80fd\u4e2d\uff0c\u652f\u6301\u591a\u6837\u7684\u7b97\u5b50\u6765\u5b9e\u73b0\u8f6c\u6362\u8fc7\u7a0b\uff0c\u5e76\u4e14\u652f\u6301DAG\u56fe\u7684\u62d6\u62c9\u62fd\u64cd\u4f5c\uff0c\u975e\u5e38\u4fbf\u6377\u548c\u7075\u6d3b\u3002<\/p>\n<p>\u800c\u6279\u91cf\u6570\u636e\u6d41\u5219\u662f\u4e00\u4e2a\u652f\u6301\u6279\u91cf\u6784\u5efa\u591a\u4e2a\u6570\u636e\u6d41\u7684\u8fc7\u7a0b\uff0c\u5b83\u5927\u5927\u7b80\u5316\u4e86\u591a\u6b21\u521b\u5efa\u548c\u8c03\u7528\u7684\u8fc7\u7a0b\uff0c\u4f46\u4ee3\u4ef7\u662f\u65e0\u6cd5\u5b9e\u73b0\u6570\u636e\u6d41\u7075\u6d3b\u7684\u8f6c\u6362\u80fd\u529b\uff0c\u4e0d\u652f\u6301DAG\u7684\u62d6\u62c9\u62fd\u3002<\/p>\n<h4>\u6570\u636e\u52a0\u8f7d\u4efb\u52a1\u7684\u8bf7\u6c42\u8fc7\u7a0b<\/h4>\n<p>\u6570\u636e\u52a0\u8f7d\u4efb\u52a1\u4e3b\u8981\u662f TDT \u4e0e Inceptor \uff08\u6216 ArgoDB\u3001Quark \u7b49\uff0c\u4ee5\u4e0b\u90fd\u7528 Inceptor \u66ff\u4ee3\uff09\u4e4b\u95f4\u534f\u4f5c\u5b8c\u6210\u7684\u3002\u6574\u4f53\u7684\u6d41\u7a0b\u56fe\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686122825726.png\" alt=\"file\" \/><\/p>\n<p>\u53ef\u4ee5\u770b\u51fa\uff0c\u6574\u4e2a\u6d41\u7a0b\u5927\u4f53\u53ef\u4ee5\u5206\u4e3a\u524d\u7aef\u914d\u7f6e\u3001TDT Server\u3001Inceptor Server\u3001Inceptor Executor \u56db\u4e2a\u8fc7\u7a0b\u3002<\/p>\n<h5>\u524d\u7aef\u914d\u7f6e<\/h5>\n<p>\u6574\u4e2a\u524d\u7aef\u914d\u7f6e\u8fc7\u7a0b\u5c31\u662f\u5728 TDS \u7684\u6570\u636e\u52a0\u8f7d\u4efb\u52a1\u914d\u7f6e\u754c\u9762\u5b8c\u6210\u7684\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686122960323.png\" alt=\"file\" \/><\/p>\n<p>Step 1. \u6e90\u7aef\u914d\u7f6e<\/p>\n<p>Step 2. \u6620\u5c04\u89c4\u5219\u914d\u7f6e<\/p>\n<p>Step 3. \u76ee\u6807\u7aef\u914d\u7f6e<\/p>\n<p>\u5728\u6574\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u6e90\u7aef\u548c\u76ee\u6807\u7aef\u7684\u9009\u62e9\u662f\u901a\u8fc7 Connector \uff08\u5373 Foundation \u7684 Connector \u89d2\u8272\uff09\u7684 API \u8c03\u7528\u5b8c\u6210\u7684\uff0c\u5982\u679c\u5728\u8be5\u8fc7\u7a0b\u51fa\u73b0\u62a5\u9519\uff0c\u9700\u8981\u67e5\u770b TDT \u548c Connector \u7684\u65e5\u5fd7\u3002<\/p>\n<p>\u9700\u8981\u7279\u522b\u6ce8\u610f\u6e90\u7aef\u914d\u7f6e\u53ef\u4ee5\u9009\u62e9\u57fa\u4e8e\u6761\u4ef6\u6216\u57fa\u4e8e\u6570\u91cf\u7684\u52a0\u8f7d\u7b56\u7565\u3002\u4e24\u79cd\u52a0\u8f7d\u7b56\u7565\u7684\u539f\u7406\u4f1a\u5728\u540e\u6587\u8be6\u8ff0\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686201015818.png\" alt=\"file\" \/><\/p>\n<h5>TDT Server<\/h5>\n<p>\u524d\u7aef\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u70b9\u51fb\u8fd0\u884c\u6216\u8c03\u8bd5\u6216\u8005\u52a0\u8f7d\u4efb\u52a1\u88ab\u8c03\u5ea6\u65f6\uff0c\u8bf7\u6c42\u5c31\u53d1\u7ed9\u4e86\u540e\u7aef\uff0c\u5230\u8fbe TDT Server\u3002<\/p>\n<p>Step 1. \u52a0\u8f7d\u9a71\u52a8\u5e76\u4e0a\u4f20\u5230 HDFS<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686200803401.png\" alt=\"file\" \/><\/p>\n<p>Step 2. \u67e5\u8be2\u6e90\u5e93\u5e76\u786e\u5b9a JDBC \u8bfb\u53d6\u6e90\u5e93\u9700\u8981\u4f7f\u7528\u7684\u8fde\u63a5\u6570<\/p>\n<p>Step 3. \u89e3\u6790\u6620\u5c04\u89c4\u5219\u5e76\u751f\u6210\u521b\u5efa\u5916\u8868<\/p>\n<p>Step 4. \u6839\u636e\u5916\u8868\u521b\u5efa\u4e2d\u95f4\u89c6\u56fe<\/p>\n<p>Step 5. \u4ece\u6700\u540e\u4e00\u4e2a\u4e2d\u95f4\u89c6\u56fe\u901a\u8fc7 INSERT INTO SELECT FROM \u7684\u65b9\u5f0f\u52a0\u8f7d\u5230\u76ee\u6807\u8868<\/p>\n<p>\u5176\u4e2d\u6b65\u9aa41\u662f TDT \u914d\u5408 Connector \u5b8c\u6210\u7684\uff0c\u6b65\u9aa42\u662f TDT \u8fde\u63a5\u6e90\u5e93\u67e5\u8be2\uff0c\u6b65\u9aa43-5\u662f TDT \u751f\u6210 SQL \u540e\u63d0\u4ea4\u5230\u6267\u884c\u7aef Inceptor \u6267\u884c\u7684\u3002<\/p>\n<h5>Inceptor Server<\/h5>\n<p>TDT Server \u6b65\u9aa43-5\u4e2d\u7684 SQL \u90fd\u4f1a\u88ab\u63d0\u4ea4\u5230 Inceptor Server \u4e0a\u3002SQL \u63d0\u4ea4\u5230 Inceptor Server \u540e\uff0c\u4e3b\u8981\u4f1a\u505a\u8bcd\u6cd5\u5206\u6790\u548c\u8bed\u6cd5\u5206\u6790\uff0c\u5982\u679c\u8bcd\u6cd5\u5206\u6790\u6216\u8bed\u6cd5\u5206\u6790\u6709\u9519\u8bef\u4f1a\u629b\u51fa\u5f02\u5e38\uff0c\u4f8b\u5982\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686201659249.png\" alt=\"file\" \/><\/p>\n<h5>Inceptor Executor<\/h5>\n<p>Inceptor Server \u4e0a\u8bcd\u6cd5\u5206\u6790\u548c\u8bed\u6cd5\u5206\u6790\u901a\u8fc7\u540e\uff0c\u7f16\u8bd1\u6210\u529f\u7684 SQL \u4f1a\u88ab\u63d0\u4ea4\u5230 Inceptor Executor \u4e0a\u3002<\/p>\n<p>Step 1. Inceptor Executor \u7684 pod \u4e2d\u4f1a\u542f\u52a8\u4e00\u4e2a tdt \u7684\u8fdb\u7a0b\u7528\u6765\u5904\u7406 InputFormat\/OutputFormat \u903b\u8f91<\/p>\n<p>\u8fd9\u4e2a\u8fdb\u7a0b\u662f\u901a\u8fc7 TDT Plugin \u542f\u52a8\u7684\uff0c\u5f53\u524d\u53ea\u8981 Inceptor \u6253\u8fc7\u6700\u65b0\u7684 Patch \u90fd\u4f1a\u81ea\u52a8\u90e8\u7f72 TDT Plugin \u3002<\/p>\n<p>Step 2. Inceptor Executor \u901a\u8fc7 tdt \u8fdb\u7a0b\u5904\u7406 InputFormat\/OutputFormat \u4f20\u8fc7\u6765\u7684\u6570\u636e\uff0c\u9891\u7e41\u4e0e\u6e90\u7aef\u6570\u636e\u5e93\u4ea4\u4e92\u3002<\/p>\n<h4>\u6570\u636e\u52a0\u8f7d\u7684\u4e24\u79cd\u7b56\u7565<\/h4>\n<p>\u6570\u636e\u52a0\u8f7d\u6709\u4e24\u79cd\u52a0\u8f7d\u7b56\u7565\uff0c\u5206\u522b\u662f\u57fa\u4e8e\u6570\u91cf\u548c\u57fa\u4e8e\u6761\u4ef6\u3002\u672c\u8282\u5c06\u63cf\u8ff0\u4ed6\u4eec\u7684\u539f\u7406\u4e0e\u533a\u522b\u3002<\/p>\n<h5>\u57fa\u4e8e\u6570\u91cf<\/h5>\n<ul>\n<li>\u786e\u5b9a mapperCount <\/li>\n<\/ul>\n<p>mapperCount \u5373\u4e3a TDT \u751f\u6210\u7684\u5916\u8868 SQL \u4e2d\u786e\u5b9a\u7684 JDBC \u8bfb\u6e90\u5e93\u7684\u8fde\u63a5\u6570\u91cf\u3002\u6bcf\u4e2a\u8fde\u63a5\u5904\u7406\u7684\u6570\u636e\u91cf\u53eb\u505a mapperSize \uff0c\u901a\u8fc7\u53c2\u6570 tdt.jdbc.mapper.size \u786e\u5b9a\uff0c\u9ed8\u8ba4\u662f 1024 \u53731GB\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686206075625.png\" alt=\"file\" \/><\/p>\n<p>\u8981\u8ba1\u7b97 mapperCount \uff0c\u8fd8\u9700\u8981\u77e5\u9053\u6e90\u8868\u7684\u6570\u636e\u91cf\uff0c\u8fd9\u4e2a\u4e00\u822c\u662f\u901a\u8fc7\u53bb\u6e90\u7aef\u7684\u7cfb\u7edf\u8868\u4e2d\u67e5\u8be2\u5f97\u5230\u7684\uff0c\u4e0d\u540c\u7684\u6570\u636e\u5e93\u67e5\u8be2\u65b9\u5f0f\u4e0d\u4e00\u6837\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686206144441.png\" alt=\"file\" \/><\/p>\n<p>\u4f46\u662f mapperCount \u4e5f\u7edd\u4e0d\u662f\u7b80\u5355\u7684\u6570\u636e\u91cf\u5927\u5c0f \/ mapperSize \u5c31\u884c\u4e86\uff0c\u56e0\u4e3a\u5b83\u8fd8\u53d7\u5230\u6e90\u5e93\u6700\u5927\u8fde\u63a5\u6570\u8fd9\u4e2a\u53c2\u6570\u7684\u5236\u7ea6\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686206371957.png\" alt=\"file\" \/><\/p>\n<p>\u6240\u4ee5 mapperCount \u7684\u7ed3\u679c\u5e94\u8be5\u662f\u4f30\u7b97\u7684\u6e90\u8868\u6570\u636e\u91cf\u5927\u5c0f\u9664\u4ee5 mapperSize \u540e\uff0c\u5411\u4e0a\u53d6\u6574\uff0c\u5982\u679c\u7ed3\u679c\u6ca1\u6709\u8d85\u8fc7\u6e90\u5e93\u6700\u5927\u8fde\u63a5\u6570\u7684\u8bdd\u8fd9\u5c31\u662f mapperCount \u7684\u503c\uff0c\u5982\u679c\u7ed3\u679c\u8d85\u8fc7\u6e90\u5e93\u6700\u5927\u8fde\u63a5\u6570\uff0c\u90a3\u4e48 mapperCount \u7684\u7ed3\u679c\u5c31\u662f\u6e90\u5e93\u6700\u5927\u8fde\u63a5\u6570\u3002<\/p>\n<p>\u7528\u4f2a\u4ee3\u7801\u8868\u793a\u7684\u8bdd\uff1a<\/p>\n<pre><code>Long mapper.size = 1024\n--\u5229\u7528\u6e90\u7aef\u6570\u636e\u5e93\u7684sql\u8ba1\u7b97\u51fa\u8868\u7684\u5927\u5c0f,\u4e0d\u540c\u7684\u6570\u636e\u5e93\u7684\u8ba1\u7b97sql\u4e0d\u4e00\u6837\nLong tabeleSize;\nLong Count;\nLong mapperCount;\n\nCount=tableSize\/mapper.size;\nmapperCount=Min(Count,MaxConnection);\n\n--\u8fdb\u884c\u5207\u5206\u65f6\uff0c\u6bcf\u4e2aoffset=tableSize\/mapperCount;<\/code><\/pre>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u82e5 mapperSize \u4e3a 1GB\uff0c\u6e90\u8868\u6570\u91cf\u4e3a5.5GB\uff0c\u5219 mapperCount \u4e3a6\uff1b\u6e90\u8868\u6570\u91cf\u4e3a 11 GB\uff0c\u5219 mapperCount \u4e3a 10\u3002<\/p>\n<p>\u5982\u679c\u62bd\u53d6\u7684\u6e90\u7aef\u662f\u666e\u901a\u89c6\u56fe\uff0c\u4e0d\u5b58\u5728\u7269\u7406\u5927\u5c0f\u6982\u5ff5\u7684\u8bdd\uff0c\u5219\u76f4\u63a5\u4f7f\u7528\u6570\u636e\u91cf\u6765\u8fdb\u884c\u5207\u5206\u3002<\/p>\n<p>mapperCount \u4f1a\u5728 TDT \u751f\u6210\u7684\u5916\u8868 SQL \u4e2d\u4f53\u73b0\uff0c\u5373<code>mapreduce.jdbc.splits.number<\/code>\u5c5e\u6027\u3002<\/p>\n<ul>\n<li>\u62c6\u5206\u7b56\u7565<\/li>\n<\/ul>\n<p>\u57fa\u4e8e\u6570\u91cf\u62c6\u5206\u7684\u539f\u7406\u662f limit <em> offset <\/em> \u8fdb\u884c\u5206\u7247\uff0coffset \u7684\u503c\u662f\u6839\u636e\u6570\u636e\u603b\u6761\u6570\u548c mapperCount \u786e\u5b9a\u7684 \uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u5904\u7406\u540c\u6837\u7684\u6570\u636e\u91cf\uff0c\u5982\u56fe\u6240\u793a\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686206822074.png\" alt=\"file\" \/><\/p>\n<h5>\u57fa\u4e8e\u6761\u4ef6<\/h5>\n<p>\u57fa\u4e8e\u6761\u4ef6\u7b56\u7565\u7684 mapperCount \u8ba1\u7b97\u903b\u8f91\u4e0e\u57fa\u4e8e\u6570\u91cf\u5b8c\u5168\u4e00\u81f4\uff0c\u53ea\u662f\u62c6\u5206\u7b56\u7565\u6709\u6240\u4e0d\u540c\u3002<\/p>\n<ul>\n<li>\u786e\u5b9a mapperCount <\/li>\n<\/ul>\n<p>mapperCount \u5373\u4e3a TDT \u751f\u6210\u7684\u5916\u8868 SQL \u4e2d\u786e\u5b9a\u7684 JDBC \u8bfb\u6e90\u5e93\u7684\u8fde\u63a5\u6570\u91cf\u3002\u6bcf\u4e2a\u8fde\u63a5\u5904\u7406\u7684\u6570\u636e\u91cf\u53eb\u505a mapperSize \uff0c\u901a\u8fc7\u53c2\u6570 tdt.jdbc.mapper.size \u786e\u5b9a\uff0c\u9ed8\u8ba4\u662f 1024 \u53731GB\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686206075625.png\" alt=\"file\" \/><\/p>\n<p>\u8981\u8ba1\u7b97 mapperCount \uff0c\u8fd8\u9700\u8981\u77e5\u9053\u6e90\u8868\u7684\u6570\u636e\u91cf\uff0c\u8fd9\u4e2a\u4e00\u822c\u662f\u901a\u8fc7\u53bb\u6e90\u7aef\u7684\u7cfb\u7edf\u8868\u4e2d\u67e5\u8be2\u5f97\u5230\u7684\uff0c\u4e0d\u540c\u7684\u6570\u636e\u5e93\u67e5\u8be2\u65b9\u5f0f\u4e0d\u4e00\u6837\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686206144441.png\" alt=\"file\" \/><\/p>\n<p>\u4f46\u662f mapperCount \u4e5f\u7edd\u4e0d\u662f\u7b80\u5355\u7684\u6570\u636e\u91cf\u5927\u5c0f \/ mapperSize \u5c31\u884c\u4e86\uff0c\u56e0\u4e3a\u5b83\u8fd8\u53d7\u5230\u6e90\u5e93\u6700\u5927\u8fde\u63a5\u6570\u8fd9\u4e2a\u53c2\u6570\u7684\u5236\u7ea6\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686206371957.png\" alt=\"file\" \/><\/p>\n<p>\u6240\u4ee5 mapperCount \u7684\u7ed3\u679c\u5e94\u8be5\u662f\u4f30\u7b97\u7684\u6e90\u8868\u6570\u636e\u91cf\u5927\u5c0f\u9664\u4ee5 mapperSize \u540e\uff0c\u5411\u4e0a\u53d6\u6574\uff0c\u5982\u679c\u7ed3\u679c\u6ca1\u6709\u8d85\u8fc7\u6e90\u5e93\u6700\u5927\u8fde\u63a5\u6570\u7684\u8bdd\u8fd9\u5c31\u662f mapperCount \u7684\u503c\uff0c\u5982\u679c\u7ed3\u679c\u8d85\u8fc7\u6e90\u5e93\u6700\u5927\u8fde\u63a5\u6570\uff0c\u90a3\u4e48 mapperCount \u7684\u7ed3\u679c\u5c31\u662f\u6e90\u5e93\u6700\u5927\u8fde\u63a5\u6570\u3002<\/p>\n<p>\u7528\u4f2a\u4ee3\u7801\u8868\u793a\u7684\u8bdd\uff1a<\/p>\n<pre><code>Long mapper.size = 1024\n--\u5229\u7528\u6e90\u7aef\u6570\u636e\u5e93\u7684sql\u8ba1\u7b97\u51fa\u8868\u7684\u5927\u5c0f,\u4e0d\u540c\u7684\u6570\u636e\u5e93\u7684\u8ba1\u7b97sql\u4e0d\u4e00\u6837\nLong tabeleSize;\nLong Count;\nLong mapperCount;\n\nCount=tableSize\/mapper.size;\nmapperCount=Min(Count,MaxConnection);\n\n--\u8fdb\u884c\u5207\u5206\u65f6\uff0c\u6bcf\u4e2aoffset=tableSize\/mapperCount;<\/code><\/pre>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u82e5 mapperSize \u4e3a 1GB\uff0c\u6e90\u8868\u6570\u91cf\u4e3a5.5GB\uff0c\u5219 mapperCount \u4e3a6\uff1b\u6e90\u8868\u6570\u91cf\u4e3a 11 GB\uff0c\u5219 mapperCount \u4e3a 10\u3002<\/p>\n<p>\u5982\u679c\u62bd\u53d6\u7684\u6e90\u7aef\u662f\u666e\u901a\u89c6\u56fe\uff0c\u4e0d\u5b58\u5728\u7269\u7406\u5927\u5c0f\u6982\u5ff5\u7684\u8bdd\uff0c\u5219\u76f4\u63a5\u4f7f\u7528\u6570\u636e\u91cf\u6765\u8fdb\u884c\u5207\u5206\u3002<\/p>\n<p>mapperCount \u4f1a\u5728 TDT \u751f\u6210\u7684\u5916\u8868 SQL \u4e2d\u4f53\u73b0\uff0c\u5373<code>mapreduce.jdbc.splits.number<\/code>\u5c5e\u6027\u3002<\/p>\n<ul>\n<li>\u62c6\u5206\u7b56\u7565<\/li>\n<\/ul>\n<p>\u57fa\u4e8e\u6761\u4ef6\u7684\u62c6\u5206\u5fc5\u987b\u6307\u5b9a\u5207\u5206\u5217\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686207036042.png\" alt=\"file\" \/><\/p>\n<p>\u901a\u8fc7\u524d\u7aef\u914d\u7f6e\u9009\u62e9\u7684\u5207\u5206\u5217\uff0c\u901a\u8fc7 select max(\u5207\u5206\u5217) from table\uff1b\u8ba1\u7b97\u51fa\u5207\u5206\u5217\u7684\u6700\u5927\u503c\uff0c\u7136\u540e\u6309\u7167 mapperCount \u8fdb\u884c\u6570\u636e\u5207\u5206\u52a0\u8f7d\u3002\u6240\u4ee5\u8981\u6c42\u5207\u5206\u5217\u7684\u6570\u636e\u5206\u5e03\u5747\u5300\uff0c\u5426\u5219\u5bb9\u6613\u51fa\u73b0\u6570\u636e\u5207\u5206\u503e\u659c\uff1b\u5e76\u4e14\u8981\u6c42\u5207\u5206\u5217\u6570\u636e\u7c7b\u578b\u652f\u6301\u6bd4\u8f83\uff0c\u4f8b\u5982\u65f6\u95f4\u7c7b\u578b\u7b49\u3002<\/p>\n<p>\u57fa\u4e8e\u6761\u4ef6\u7b56\u7565\u7684\u4f7f\u7528\u7684\u65b9\u6cd5\u662f\u901a\u8fc7\u5207\u5206\u5217\u8fdb\u884c\u6570\u636e\u8303\u56f4\u7684\u5747\u5300\u5207\u5206\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2023\/06\/image-1686207148044.png\" alt=\"file\" \/><\/p>\n<h5>\u4e24\u79cd\u7b56\u7565\u7684\u6ce8\u610f\u4e8b\u9879<\/h5>\n<ul>\n<li>\n<p>\u57fa\u4e8e\u6570\u91cf\u7b56\u7565\u4e0d\u63a8\u8350\u7528\u4e8e\u6e90\u7aef\u6709\u5927\u91cf\u53d8\u5316\u7684\u573a\u666f\uff0c\u5426\u5219\u5bb9\u6613\u51fa\u73b0\u4e22\u6570\u6216\u91cd\u590d\u6570\u636e\u7684\u95ee\u9898<\/p>\n<\/li>\n<li>\n<p>\u57fa\u4e8e\u6570\u91cf\u7b56\u7565\u7684\u6027\u80fd\u5f71\u54cd\u56e0\u7d20\u4e3b\u8981\u6709 count(*) \u8bed\u53e5\u6267\u884c\u6548\u7387\u548c\u5747\u5206\u6570\u636e\u7684 SQL \u6267\u884c\u6548\u7387<\/p>\n<\/li>\n<li>\n<p>\u57fa\u4e8e\u6761\u4ef6\u7b56\u7565\u5efa\u8bae\u5207\u5206\u5217\u7684\u6570\u503c\u5206\u5e03\u5747\u5300\uff0c\u5426\u5219\u4f1a\u51fa\u73b0\u67d0\u4e9b\u7ebf\u7a0b\u6570\u636e\u503e\u659c\u7684\u95ee\u9898\uff0c\u5f71\u54cd\u6574\u4e2a\u4efb\u52a1\u6267\u884c\u7684\u6027\u80fd<\/p>\n<\/li>\n<li>\n<p>\u57fa\u4e8e\u6761\u4ef6\u7b56\u7565\u7684\u5207\u5206\u5217\u6700\u597d\u662f\u6570\u503c\u578b\u6216\u65f6\u95f4\u578b<\/p>\n<\/li>\n<\/ul>\n<h4>\u4efb\u52a1\u8fde\u63a5\u6570\u53ca\u5e76\u53d1\u5ea6<\/h4>\n<p>TDT \u901a\u8fc7\u4efb\u52a1\u914d\u7f6e\u7684\u6e90\u7aef\u6700\u5927\u8fde\u63a5\u6570\u53ca\u5141\u8bb8\u6700\u5927\u5e76\u53d1\u5ea6\u6765\u9650\u5236\u4eba\u7269\u7684\u6267\u884c\u3002<\/p>\n<ol>\n<li>\n<p>\u4efb\u52a1\u6267\u884c\u524d\uff0c\u4f1a\u5148\u83b7\u53d6\u6e90\u8868\u6570\u636e\u4fe1\u606f\uff0c\u83b7\u53d6\u6570\u636e\u91cf\u3001\u8ba1\u7b97\u8868\u5927\u5c0f<\/p>\n<\/li>\n<li>\n<p>\u5141\u8bb8\u6700\u5927\u5e76\u53d1\u5ea6\u9650\u5236\u7684\u662f\u540c\u65f6\u6267\u884c\u7684\u5b50\u4efb\u52a1\u7684\u6570\u91cf<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u9645\u6267\u884c\u53d7\u5230\u6e90\u7aef\u6700\u5927\u8fde\u63a5\u6570\u4e0e\u76ee\u6807\u7aef\u6700\u5927\u5e76\u53d1\u5ea6\u7684\u5171\u540c\u9650\u5236<\/p>\n<\/li>\n<li>\n<p>\u5b50\u4efb\u52a1\u6267\u884c\u7ed3\u675f\uff0c\u4f1a\u91ca\u653e\u5360\u6709\u7684\u8fde\u63a5\u6570\u53ca\u5e76\u53d1\u6570<\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981\u63cf\u8ff0 \u672c\u6587\u4e3b\u8981\u63cf\u8ff0 TDS \uff082.x\u53ca\u4ee5\u4e0a\u7248\u672c\uff09\u6570\u636e\u52a0\u8f7d\u7684\u57fa\u672c\u539f\u7406\u3002 \u8be6\u7ec6\u8bf4\u660e Transporter \u6982 ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/kbwp.transwarp.cn\/?p=10354\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":81,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[121],"tags":[],"class_list":["post-10354","post","type-post","status-publish","format-standard","hentry","category-121"],"acf":[],"_links":{"self":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/10354","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10354"}],"version-history":[{"count":3,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/10354\/revisions"}],"predecessor-version":[{"id":10393,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/10354\/revisions\/10393"}],"wp:attachment":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}