MongoDB MapReduce Combat <1>

Source: Internet
Author: User
Tags mongodb support

    • requirements, MySQL table in a log table, require the average record period of statistical data, learning in practice, with MySQL may be more troublesome, then use the newly-contacted MongoDB bar, but also with the Hadoop research last year to touch the edge, and MongoDB support MapReduce, Last year has been want to know more, but too busy, no time, just now look at the study.
    • Using the command line is tiring, so using the Mongovue, this tool.
    • Started:
      1. Parse table structure, useful field one is the record ID (repeatable), one is the time the record is generated;
      2. Import the required fields and data into MongoDB;
      3. Write the first mapreduce, merging the time that is generated by the record, as follows:
        {"ID": "1001", "DATES": [' 2014/2/10 ', ' 2014/2/9 ', ' 2014/2/6 ']}
      4. Write the second mapreduce, averaging the time for each record, as above:
        ((February 10-February 9) + (February 9-February 6)) divided by 2
      5. Finally, all records are again calculated
    • The first step is to import the data step (the borrowed image found on the Web):
    • Select MySQL Database

    • Establishing a database connection

    • Select Table

    • Select field

    • Complete

MongoDB MapReduce Combat <1>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.