java - 使用 MapReduce 拆分字符串并重建它

标签 java hadoop mapreduce query-string

您好,我是 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/

相关文章:

java - 用于 HTML 嵌入式 Base64 图像的 JEditorPane 内容类型

java - 无法找到或加载主类 org.apache.hadoop.mapred.YarnChild Hadoop3.0.0

java - 如何以 csv 格式输出 hadoop 结果

hadoop - Hadoop应用程序中Avro的用例

java - 使用 Google Analytics 时无法解析符号 'analytics'

dictionary - ConcurrentHashMap如何获取tailMap?

java - hadoop 上的 JSON 处理

hadoop - saveAsNewAPIHadoopFile 将字符编码更改为 UTF-8

hadoop - 实现预期输出所需的 talend 组件

java - 如何将来自外部源(主要是Restful)的数据引入HDFS?