Giter Club home page Giter Club logo

searchloganalyze's Introduction

搜索引擎一般会有一个日志文件来记录所有用户的查询,当有一个用户使用搜索引擎进行搜索时,日志文件会记录这样一条记录:(搜索时间、搜索关键字、用户IP)。由于搜索引擎用户量较大,这个日志文件往往很大,一般可以存放在分布式文件系统中,例如HDFS中。分析这个日志文件,我们可以得到搜索引擎在近一段时间内的热点词(即搜索较多的词,例如一天内搜索次数最多的50个关键词,也即日志文件中出现次数最多的50个搜索关键字)。
请使用HDFS接口来自动生成这样一个日志文件,日志文件中每行的内容要求是如下格式:
---------------------------------------------
日期 时间 关键词 IP地址
---------------------------------------------
2011-10-26 06:11:35 云计算 210.77.23.12
2011-10-26 06:11:45 Hadoop 210.77.23.12
---------------------------------------------
注意:记录中日期,时间,IP地址必须是有效的,即不能出现-1.-1.-1.-2这样的IP地址(随机数即可产生有效的IP)。关键词可以是任意词,不需要保证必须有意义,只需要是一个字符串即可,中英文都可以(可以随机产生)。
编写MapReduce程序对日志文件做分析,找出日志文件中的热点词:(1)所有日志中出现次数最多的50个关键词;(2)特定日期区间日志中出现次数最多的50个关键词;(3)特定IP地址区间(假定前3段相同,区间在4段中设定)日志中出现次数最多的50个关键词。
要求将结果输出在文件中,文件中的每行记录是:关键词 出现次数。文件从前到后,关键词是按次数从多到小排序的,例如:
云计算 5980
并行计算 5976
分布式 5878

searchloganalyze's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

witnesslq

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.