• <legend id='55Qok'><style id='55Qok'><dir id='55Qok'><q id='55Qok'></q></dir></style></legend>
  • <tfoot id='55Qok'></tfoot>

    1. <small id='55Qok'></small><noframes id='55Qok'>

        <bdo id='55Qok'></bdo><ul id='55Qok'></ul>

    2. <i id='55Qok'><tr id='55Qok'><dt id='55Qok'><q id='55Qok'><span id='55Qok'><b id='55Qok'><form id='55Qok'><ins id='55Qok'></ins><ul id='55Qok'></ul><sub id='55Qok'></sub></form><legend id='55Qok'></legend><bdo id='55Qok'><pre id='55Qok'><center id='55Qok'></center></pre></bdo></b><th id='55Qok'></th></span></q></dt></tr></i><div id='55Qok'><tfoot id='55Qok'></tfoot><dl id='55Qok'><fieldset id='55Qok'></fieldset></dl></div>

        使用 Hadoop 计算唯一身份访问者的最佳方法是什么

        时间:2023-09-12

          <tfoot id='YA3RC'></tfoot>

          <small id='YA3RC'></small><noframes id='YA3RC'>

            <bdo id='YA3RC'></bdo><ul id='YA3RC'></ul>

            <legend id='YA3RC'><style id='YA3RC'><dir id='YA3RC'><q id='YA3RC'></q></dir></style></legend>
                <tbody id='YA3RC'></tbody>
              <i id='YA3RC'><tr id='YA3RC'><dt id='YA3RC'><q id='YA3RC'><span id='YA3RC'><b id='YA3RC'><form id='YA3RC'><ins id='YA3RC'></ins><ul id='YA3RC'></ul><sub id='YA3RC'></sub></form><legend id='YA3RC'></legend><bdo id='YA3RC'><pre id='YA3RC'><center id='YA3RC'></center></pre></bdo></b><th id='YA3RC'></th></span></q></dt></tr></i><div id='YA3RC'><tfoot id='YA3RC'></tfoot><dl id='YA3RC'><fieldset id='YA3RC'></fieldset></dl></div>

                1. 本文介绍了使用 Hadoop 计算唯一身份访问者的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  大家好,刚刚开始使用 hadoop,并且好奇如果您的日志文件看起来像这样,在 mapreduce 中计算唯一访问者的最佳方法是什么...

                  hey all, just getting started on hadoop and curious what the best way in mapreduce would be to count unique visitors if your logfiles looked like this...

                  DATE       siteID  action   username
                  05-05-2010 siteA   pageview jim
                  05-05-2010 siteB   pageview tom
                  05-05-2010 siteA   pageview jim
                  05-05-2010 siteB   pageview bob
                  05-05-2010 siteA   pageview mike
                  

                  对于每个站点,您想找出每个站点的唯一访问者?

                  and for each site you wanted to find out the unique visitors for each site?

                  我在想映射器会发出 siteID 用户名并且 reducer 会为每个键保留一个唯一用户名的 set(),然后发出该集合的长度.但是,这可能会在内存中存储数百万个用户名,这似乎并不正确.谁有更好的方法?

                  I was thinking the mapper would emit siteID username and the reducer would keep a set() of the unique usersnames per key and then emit the length of that set. However that would be potentially storing millions of usernames in memory which doesn't seem right. Anyone have a better way?

                  顺便说一句,我正在使用 python 流媒体

                  I'm using python streaming by the way

                  谢谢

                  推荐答案

                  你可以把它作为一个 2-stage 操作:

                  You could do it as a 2-stage operation:

                  第一步,发出 (username => siteID),然后让 reducer 使用 set 折叠多次出现的 siteID - 因为你通常有很远网站比用户少,这应该没问题.

                  First step, emit (username => siteID), and have the reducer just collapse multiple occurrences of siteID using a set - since you'd typically have far less sites than users, this should be fine.

                  然后在第二步中,您可以发出 (siteID => username) 并进行简单的计数,因为重复项已被删除.

                  Then in the second step, you can emit (siteID => username) and do a simple count, since the duplicates have been removed.

                  这篇关于使用 Hadoop 计算唯一身份访问者的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Python Hadoop Streaming 错误“ERROR streaming.StreamJob:作业 下一篇:Windows 上的 Python Hadoop 流式传输,脚本不是有效的

                  相关文章

                  最新文章

                    1. <legend id='tKQpc'><style id='tKQpc'><dir id='tKQpc'><q id='tKQpc'></q></dir></style></legend>

                      <small id='tKQpc'></small><noframes id='tKQpc'>

                    2. <tfoot id='tKQpc'></tfoot>

                      <i id='tKQpc'><tr id='tKQpc'><dt id='tKQpc'><q id='tKQpc'><span id='tKQpc'><b id='tKQpc'><form id='tKQpc'><ins id='tKQpc'></ins><ul id='tKQpc'></ul><sub id='tKQpc'></sub></form><legend id='tKQpc'></legend><bdo id='tKQpc'><pre id='tKQpc'><center id='tKQpc'></center></pre></bdo></b><th id='tKQpc'></th></span></q></dt></tr></i><div id='tKQpc'><tfoot id='tKQpc'></tfoot><dl id='tKQpc'><fieldset id='tKQpc'></fieldset></dl></div>
                        <bdo id='tKQpc'></bdo><ul id='tKQpc'></ul>