
MapReduce
文章平均质量分 87
dushenzhi
个人主页:http://dushenzhi.top
展开
-
通过Partition把map的结果输出到到n个不同的reduce
默认的Partition无法满足我们的需求,因此需要自定义partition过程。根据map输出的不同key值,通过partition把map输出的数据输出到numReduceTasks个不同的reduce上去。 public static class Selector extends Partitioner{ @Override public int getPartition(原创 2012-07-02 16:48:07 · 909 阅读 · 0 评论 -
用Python编写MapReduce的WordCount实例程序
条件,假设hadoop环境和python环境已经安装好,且hadoop已正常启动Hadoop Streaming为python的语言提供了编写MapReduce程序的map和reduce的方法,下面介绍如何用Python编写一个WordCount实例程序。map过程的python源文件wc_map.py:#!/usr/bin/env pythonimport sysfor line原创 2013-07-15 18:05:01 · 3817 阅读 · 2 评论