【问题标题】:Use MapReduce to split a strings and rebuild it使用 MapReduce 拆分字符串并重建它
【发布时间】:2014-02-28 04:11:43
【问题描述】:

您好,我是 Hadoop 和 MapReduce 编程的新手。我正在处理一堆我们必须了解访问行为的 apache 日志。我们现在正在查看实际的 URI 和引荐来源 URI。这些引用 URI 是一个查询字符串,我正在尝试通过 MapReduce 的 Mapper 解析该查询字符串,并且由于我没有任何 reducer 功能,因此我没有构建真正的 reducer。

 #   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)"

这是一个使用仅映射 hadoop 作业的好用例吗?我们拥有的日志数量超过 1 PB,我们预计会增长。

【问题讨论】:

  • 您只是想用更改的日志字符串修改所有日志文件?

标签: java hadoop mapreduce query-string


【解决方案1】:

是的。如果您只需要映射数据,则不需要 reduce 步骤。确保将 numReducers 设置为零,以便完全跳过 reduce 步骤。

【讨论】:

  • 你好,climbage,你有什么例子可以用于这个场景吗?
  • 嗯,这不是我的想法。我敢肯定他们在那里。
猜你喜欢
  • 2020-04-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-29
  • 2020-01-07
  • 1970-01-01
  • 1970-01-01
  • 2015-10-24
相关资源
最近更新 更多