{"id":67,"date":"2022-03-02T10:42:06","date_gmt":"2022-03-02T10:42:06","guid":{"rendered":"https:\/\/blog.liguanxin.cn\/?p=67"},"modified":"2022-03-08T08:50:19","modified_gmt":"2022-03-08T08:50:19","slug":"%e5%88%86%e5%b8%83%e5%bc%8f%e7%b3%bb%e7%bb%9f%e7%9a%84%e5%bc%80%e5%b1%b1%e4%b9%8b%e4%bd%9cmapreduce%e8%ae%ba%e6%96%87%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/blog.liguanxin.cn\/index.php\/2022\/03\/02\/%e5%88%86%e5%b8%83%e5%bc%8f%e7%b3%bb%e7%bb%9f%e7%9a%84%e5%bc%80%e5%b1%b1%e4%b9%8b%e4%bd%9cmapreduce%e8%ae%ba%e6%96%87%e8%a7%a3%e6%9e%90\/","title":{"rendered":"\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5f00\u5c71\u4e4b\u4f5cMapReduce\u8bba\u6587\u89e3\u6790"},"content":{"rendered":"<p>MapReduce\u662f\u4e00\u79cd\u7528\u4e8e\u5904\u7406\u548c\u751f\u6210\u5927\u578b\u6570\u636e\u96c6\u7684\u7f16\u7a0b\u6a21\u578b\u548c\u76f8\u5173\u5b9e\u73b0\u3002<\/p>\n<p><strong>\u6838\u5fc3\uff1a<\/strong><\/p>\n<p>map\u51fd\u6570\uff1a\u5904\u7406\u6307\u5b9a\u7684\u952e\u503c\u4ee5\u751f\u6210\u4e2d\u95f4\u952e\u503c\u5bf9\u3002<\/p>\n<p>reduce\u51fd\u6570\uff1a\u5408\u5e76\u5173\u8054\u7684\u4e2d\u95f4\u952e\u5bf9\u5e94\u7684\u4e2d\u95f4\u503c\u3002<\/p>\n<p><strong>\u6982\u5ff5\u7c7b\u578b\uff1a<\/strong><\/p>\n<p><img src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-6.png\" alt=\"\" \/><\/p>\n<p><strong>\u7b80\u5355\u4f8b\u5b50\uff1a<\/strong><\/p>\n<p>\u7edf\u8ba1\u7f51\u7ad9\u8bbf\u95ee\u6b21\u6570\uff1amap\u8fd4\u56de&lt;URL, 1&gt;\uff0creduce\u53d1\u51fa&lt;URL, total count&gt;<\/p>\n<h2>MapReduce\u6267\u884c\u8fc7\u7a0b<\/h2>\n<p><img src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/03\/image-7.png\" alt=\"\" \/><\/p>\n<p>\u9996\u5148\u8f93\u5165\u6587\u4ef6\u53ef\u4ee5\u7531\u4e0d\u540c\u7684\u673a\u5668\u5e76\u884csplit\u4e3aM\u4efd\uff0c\u7528\u6237\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u5206\u5272\u51fd\u6570\u548c\u5206\u5272\u6570\u91cfR\u6765\u5bf9\u4e2d\u95f4\u952e\u503c\u5bf9\u5212\u5206\u3002<\/p>\n<p>MapReduce\u51fd\u6570\u5f00\u59cb\u540e\uff0c\u4f1a\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<p>1\u3001\u628a\u8f93\u5165\u6587\u4ef6split\u4e3a16~64MB\u7684M\u4e2a\u6587\u4ef6\u3002<\/p>\n<p>2\u3001\u5269\u4f59\u7684worker\u5c06\u7531master\u8fdb\u7a0b\u6307\u6d3e\uff0cmaster\u4f1a\u6311\u9009\u95f2\u7f6e\u7684worker\u6267\u884cmap\u6216\u8005reduce\u4efb\u52a1\u3002<\/p>\n<p>3\u3001\u6536\u5230map\u4efb\u52a1\u7684worker\u4f1a\u5904\u7406\u76f8\u5e94\u7684\u8f93\u5165\uff0c\u5c06\u8f93\u5165\u89e3\u6790\u4e3a\u952e\u503c\u5bf9\u5e76\u8c03\u7528\u7528\u6237\u5b9a\u4e49\u7684Map\u51fd\u6570\uff0c\u4ea7\u751f\u7684\u4e2d\u95f4\u952e\u503c\u5bf9\u4f1a\u653e\u5165\u5185\u5b58\u7f13\u51b2\u533a\u3002<\/p>\n<p>4\u3001\u7f13\u51b2\u533a\u7684\u952e\u503c\u5bf9\u4f1a\u5468\u671f\u6027\u5730\u5199\u5165\u672c\u5730\uff0c\u540c\u65f6\u6839\u636e\u7528\u6237\u5b9a\u4e49\u7684\u5206\u5272\u51fd\u6570\u5206\u4e3aR\u4e2a\u90e8\u5206\u3002\u4fdd\u5b58\u4e4b\u540e\u4f1a\u628a\u5b58\u653e\u4f4d\u7f6e\u544a\u8bc9master\uff0cmaster\u4f1a\u8f6c\u53d1\u7ed9reduce worker\u3002<\/p>\n<p>5\u3001\u5f53reduce worker\u88ab\u544a\u77e5\u4f4d\u7f6e\u540e\uff0c\u5b83\u4f1a\u8fdc\u7a0b\u8c03\u7528\u5b58\u50a8\u5728map worker\u78c1\u76d8\u4e0a\u7684\u672c\u5730\u6570\u636e\u3002\u8bfb\u53d6\u5b8c\u540e\u4f1a\u901a\u8fc7\u4e2d\u95f4\u952e\u5bf9\u5176\u8fdb\u884c\u6392\u5e8f\uff0c\u4ee5\u4fbf\u76f8\u540c\u7684\u952e\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5982\u679c\u6570\u636e\u91cf\u592a\u5927\uff0c\u4f1a\u4f7f\u7528\u5916\u90e8\u6392\u5e8f\u3002<\/p>\n<p>6\u3001reduce worker\u904d\u5386\u6392\u597d\u5e8f\u7684\u4e2d\u95f4\u6570\u636e\uff0c\u5bf9\u4e8e\u6bcf\u4e2a\u552f\u4e00\u7684\u4e2d\u95f4\u952e\uff0c\u5b83\u4f1a\u96c6\u5408\u76f8\u5e94\u7684\u4e2d\u95f4\u503c\u8ba9\u7528\u6237\u5b9a\u4e49\u7684Reduce\u51fd\u6570\u8fdb\u884c\u5904\u7406\u3002Reduce\u51fd\u6570\u7684\u8f93\u51fa\u4f1a\u8ffd\u52a0\u5230\u5f53\u524d\u7684\u8f93\u51fa\u6587\u4ef6\u4e2d\u3002<\/p>\n<p>7\u3001\u5f53\u6240\u6709map\u548creduce\u4efb\u52a1\u90fd\u5b8c\u6210\uff0cmaster\u4f1a\u5524\u9192\u7528\u6237\u8fdb\u7a0b\uff0c\u628a\u6570\u636e\u8fd4\u56de\u7ed9\u7528\u6237\u3002<\/p>\n<p>\u901a\u5e38\u5b8c\u6210\u540e\uff0c\u7528\u6237\u4e0d\u9700\u8981\u628aR\u4e2a\u8f93\u51fa\u6587\u4ef6\u5408\u5e76\u6210\u4e00\u4e2a\uff0c\u8fd9\u4e9b\u6587\u4ef6\u4f1a\u4f20\u9012\u5230\u53e6\u5916\u7684MapReduce\u5904\u7406\u3002<\/p>\n<h2>Master\u6570\u636e\u7ed3\u6784<\/h2>\n<p>\u5bf9\u6bcf\u4e2amap\u548creduce\u4efb\u52a1\uff0c\u5b58\u50a8\u5176\u72b6\u6001\uff08\u7a7a\u95f4\uff0c\u5904\u7406\u4e2d\uff0c\u5b8c\u6210\uff09<\/p>\n<p>\u4ee5\u53ca\u6bcf\u4e2aworker\u7684\u72b6\u6001\uff08\u7528\u4e8e\u975e\u7a7a\u95f2\u7684\u4efb\u52a1\uff09<\/p>\n<p>master\u8fd8\u4f1a\u628a\u4e2d\u95f4\u6587\u4ef6\u7684\u4f4d\u7f6e\u548c\u5927\u5c0f\u8f6c\u53d1\u7ed9reduce worker\u3002<\/p>\n<h2>MapReduce\u5bb9\u9519<\/h2>\n<ul>\n<li>\n<p>worker\u5931\u6548<\/p>\n<p>\u6bcf\u9694\u4e00\u6bb5\u65f6\u95f4master\u4f1aping\u6bcf\u4e00\u4e2aworker\uff0c\u5982\u679c\u67d0\u4e2aworker\u4e00\u6bb5\u65f6\u95f4\u5185\u6ca1\u6709\u56de\u5e94\uff0c\u5219\u6807\u8bb0\u4e3a\u4e0d\u53ef\u7528\u3002\u5982\u679cworker\u5931\u8d25\uff0c\u5219\u5bf9\u4e8e\u5b83\u8fdb\u884c\u7684map\u6216reduce\u4efb\u52a1\u5c06\u91cd\u7f6e\u4e3a\u7a7a\u95f2\uff0c\u53ef\u4ee5\u91cd\u65b0\u5b89\u6392\u3002<\/p>\n<p>\u5982\u679cmap\u4efb\u52a1\u5bf9\u5e94\u7684worker\u6545\u969c\uff0c\u5219\u610f\u5473\u7740\u5bf9\u5e94\u7684\u672c\u5730\u6587\u4ef6\u635f\u574f\uff0c\u9664\u4e86\u6240\u6709map worker\u8981\u91cd\u65b0\u5206\u914d\uff0c\u4e5f\u8981\u901a\u77e5reduce worker\u91cd\u65b0\u6267\u884c\uff0c\u4e14\u4ece\u65b0\u7684\u5b58\u50a8\u8def\u5f84\u83b7\u53d6\u3002<\/p>\n<p>\u800c\u5982\u679c\u662freduce\u4efb\u52a1\u5bf9\u5e94\u7684\u67d0\u4e2aworker\u6545\u969c\uff0c\u5219\u5df2\u5b8c\u6210\u7684reduce\u4efb\u52a1\u4e0d\u9700\u8981\u91cd\u65b0\u6267\u884c\uff0c\u56e0\u4e3a\u6587\u4ef6\u4fdd\u5b58\u5728\u5168\u5c40\u6587\u4ef6\u7cfb\u7edf\u4e2d\u3002<\/p>\n<\/li>\n<li>\n<p>master\u5931\u6548<\/p>\n<p>\u53ef\u4ee5\u8ba9master\u6bcf\u9694\u4e00\u6bb5\u65f6\u95f4\u4fdd\u5b58\u4e00\u4e2acheckpoint\u6587\u4ef6\u3002\u5982\u679cmaster\u6302\u4e86\uff0c\u53ef\u4ee5\u4ececheckpoint\u6587\u4ef6\u6062\u590d\u3002\u4e00\u822c\u6765\u8bf4master\u5931\u6548\u7684\u60c5\u51b5\u6bd4\u8f83\u5c11\u89c1\u3002<\/p>\n<\/li>\n<li>\n<p>\u7528\u6237\u63d0\u4f9b\u7684map\u548creduce\u8bed\u4e49\u4e0d\u660e\u786e<\/p>\n<\/li>\n<\/ul>\n<h2>\u672c\u5730\u5316<\/h2>\n<p>\u4e3a\u4e86\u51cf\u5c11\u6570\u636e\u4ea4\u6362\u65f6\u7684\u4f20\u8f93\u65f6\u95f4\uff0c\u901a\u5e38\u4f1a\u628a\u8f93\u5165\u6570\u636e\u5148\u5b58\u50a8\u5728\u79bb\u96c6\u7fa4\u6bd4\u8f83\u8fd1\u7684\u672c\u5730\u78c1\u76d8\u4e2d\u3002<\/p>\n<h2>\u5907\u4efd\u4efb\u52a1<\/h2>\n<p>MapReduce\u6267\u884c\u65f6\u95f4\u8f83\u957f\u901a\u5e38\u662f\u56e0\u4e3a\u67d0\u4e2aworker\u82b1\u8d39\u592a\u65f6\u95f4\u3002\u4e8e\u662f\u53ef\u4ee5\u5728\u5f53MapReduce\u63a5\u8fd1\u5b8c\u6210\u7684\u65f6\u5019\uff0c\u5c06\u5269\u4f59\u7684\u4efb\u52a1\u540c\u65f6\u5206\u7ed9\u5176\u4ed6\u7a7a\u95f2\u7684worker\u4e00\u8d77\u6267\u884c\uff0c\u5f53\u67d0\u4e2aworker\u5b8c\u6210\u540e\u6807\u8bb0\u4e3a\u5df2\u5b8c\u6210\u3002<\/p>\n<h4>\u5f88\u591a\u65f6\u5019\u4e0d\u662fmap\u5b8c\u6210\u540e\u624d\u6267\u884creduce\u64cd\u4f5c\uff0c\u5728\u4e00\u4e9b\u7a0b\u5e8f\u4e0amap\u5b8c\u621095%\u751a\u81f3\u66f4\u4f4e\u5c31\u53ef\u4ee5\u5f00\u59cbreduce\u4e86\u3002<\/h4>\n","protected":false},"excerpt":{"rendered":"<p>MapReduce\u662f\u4e00\u79cd\u7528\u4e8e\u5904\u7406\u548c\u751f\u6210\u5927\u578b\u6570\u636e\u96c6\u7684\u7f16\u7a0b\u6a21\u578b\u548c\u76f8\u5173\u5b9e\u73b0\u3002 \u6838\u5fc3\uff1a map\u51fd\u6570\uff1a\u5904\u7406\u6307\u5b9a\u7684\u952e\u503c\u4ee5\u751f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":72,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts\/67"}],"collection":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/comments?post=67"}],"version-history":[{"count":3,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts\/67\/revisions"}],"predecessor-version":[{"id":128,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts\/67\/revisions\/128"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/media\/72"}],"wp:attachment":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/media?parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/categories?post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/tags?post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}