您好,我是 Hadoop 和 MapReduce 编程的新手。我正在处理一堆我们必须了解访问行为的 apache 日志。我们现在正在查看实际 URI 和引荐来源网址 URI。这些引荐来源网址 URI 来自一个查询字符串,我试图通过 MapReduce 的映射器解析该查询字符串,并且由于我没有任何缩减器功能,所以我没有构建真正的缩减器。
# ip datetime method uri status code refUri userAgent
79.28.43.25 - - [25/Jan/2009:13:18:02 +0000] "GET /blog/2007/01/internet-explorer-7-in-italiano/ HTTP/1.1" 200 14487 "http://www.google.it/search?hl=it&q=aggiornamento+internet+explorer+&btnG=Cerca+con+Google&meta=&aq=f&oq=" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
现在我想把这一行转换成
# ip datetime method uri status code refUri h1 q btnG meta aq oq userAgent
79.28.43.25 - - [25/Jan/2009:13:18:02 +0000] "GET /blog/2007/01/internet-explorer-7-in-italiano/ HTTP/1.1" 200 14487 "http://www.google.it/search?hl=it&q=aggiornamento+internet+explorer+&btnG=Cerca+con+Google&meta=&aq=f&oq=" "it" "aggiornamento+internet+explorer+" "Cerca+con+Google" "" "f" "" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
这是使用 map only hadoop 作业的好用例吗?我们拥有的日志数量超过 1 PB,并且我们预计该数量还会增长。
最佳答案
是的。如果您只需要映射数据,则不需要 reduce 步骤。确保将 numReducers 设置为零,以便完全跳过 reduce 步骤。
关于java - 使用 MapReduce 拆分字符串并重建它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22086024/