map/reduce 學習筆記

1. 在eclipse下,經過main函數傳遞參數給mapper java

在main()中設置configuration,添加名爲temp的參數 app

Configuration conf=getConf();
conf.set("temp", "the arg which you need in mapper");
Job job = new Job(conf, "Idf");//特別要注意的就是這條語句和上面一行毫不能顛倒
在map/reduce中重載setup( Context context) ,並在其中獲取參數

String s=context.getConfiguration().get("temp");
相關文章
相關標籤/搜索