Deploying Hadoop + MongoDB Running environment

Source: Internet
Author: User
Keywords Run and then Xml http first

First download Mongo-hadoop Adapter

git clone https://github.com/mongodb/mongo-hadoop.git

git checkout release-1.0

Then go to the Mongo-hadoop directory and find BUILD.SBT to modify hadoop920.html ">release in Thisbuild as follows:

Hadooprelease in Thisbuild: = "0.20"

Then run./SBT package (about SBT Https://github.com/harrah/xsbt/wiki)

It is necessary to turn the & wall when running.

At the end of the run, a jar file Mongo-hadoop-core_0.20.205.0-1.0.1.jar is core/target in the directory, then the MongoDB driver package is downloaded.

wget--no-check-certificate Https://github.com/downloads/mongodb/mongo-java-driver/mongo-2.7.3.jar After downloading, you can start to develop the Mongo-hadoop program.

Run the sample: first import the data into the MongoDB, and the commands are as follows.

./SBT Load-sample-data

Then create a new project in Eclipe, such as Treasury, to copy the source and resource files from Mongo-hadoop/example/treasury_field to the new project.

As shown in the figure:

Then modify the URL of the MongoDB in the Mongo-treasury_yield.xml file and store collection

Mongo.input.uri

Mongodb://127.0.0.1/mongo_hadoop.yield_historical.in

Mongo.output.uri

Mongodb://127.0.0.1/mongo_hadoop.yield_historical.out

Then modify the Treasuryyieldxmlconfig.java as follows:

Configuration.adddefaultresource ("Resources/mongo-treasury_yield.xml");

Configuration.adddefaultresource ("Resources/mongo-defaults.xml");

The project is packaged into a jar file.

Run Hadoop jar Treasury.jar Com.mongodb.hadoop.treasury.TreasuryXMLConfig to run the Hadoop program. The results of the operation are as follows: Data in MongoDB.

Copyright: Original works, allow reprint, reprint, please be sure to hyperlink form to indicate the original source of the article, author information and this statement. Otherwise, it will be held liable http://www.51ou.com/browse/MongoDB/51808.html

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.