Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7734705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:19:02+00:00 2026-06-01T07:19:02+00:00

Summary: Is it possible to: Import data into Hadoop with the «MongoDB Connector for

  • 0

Summary:

Is it possible to:

  1. Import data into Hadoop with the «MongoDB Connector for Hadoop».
  2. Process it with Hadoop MapReduce.
  3. Export it with Sqoop in a single transaction.

I am building a web application with MongoDB. While MongoDB work well for most of the work, in some parts I need stronger transactional guarantees, for which I use a MySQL database.

My problem is that I want to read a big MongoDB collection for data analysis, but the size of the collection means that the analytic job would take too long to process. Unfortunately, MongoDB’s built-in map-reduce framework would not work well for this job, so I would prefer to carry out the analysis with Apache Hadoop.

I understand that it is possible read data from MongoDB into Hadoop by using the «MongoDB Connector for Hadoop», which reads data from MongoDB, processes it with MapReduce in Hadoop, and finally outputs the results back into a MongoDB database.

The problem is that I want the output of the MapReduce to go into a MySQL database, rather than MongoDB, because the results must be merged with other MySQL tables.

For this purpose I know that Sqoop can export result of a Hadoop MapReduce into MySQL.

Ultimately, I want too read MongoDB data then process it with Hadoop and finally output the result into a MySQL database.

Is this possible? Which tools are available to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:19:04+00:00Added an answer on June 1, 2026 at 7:19 am

    TL;DR: Set an an output formatter that writes to a RDBS in your Hadoop job:

     job.setOutputFormatClass( DBOutputFormat.class );
    

    Several things to note:

    1. Exporting data from MongoDB to Hadoop using Sqoop is not possible. This is because Sqoop uses JDBC which provides a call-level API for SQL-based database, but MongoDB is not an SQL-based database. You can look at the «MongoDB Connector for Hadoop» to do this job. The connector is available on GitHub. (Edit: as you point out in your update.)

    2. Sqoop exports are not made in a single transaction by default. Instead, according to the Sqoop docs:

      Since Sqoop breaks down export process into multiple transactions, it is possible that a failed export job may result in partial data being committed to the database. This can further lead to subsequent jobs failing due to insert collisions in some cases, or lead to duplicated data in others. You can overcome this problem by specifying a staging table via the --staging-table option which acts as an auxiliary table that is used to stage exported data. The staged data is finally moved to the destination table in a single transaction.

    3. The «MongoDB Connector for Hadoop» does not seem to force the workflow you describe. According to the docs:

      This connectivity takes the form of allowing both reading MongoDB data into Hadoop (for use in MapReduce jobs as well as other components of the Hadoop ecosystem), as well as writing the results of Hadoop jobs out to MongoDB.

    4. Indeed, as far as I understand from the «MongoDB Connector for Hadoop»: examples, it would be possible to specify a org.apache.hadoop.mapred.lib.db.DBOutputFormat into your Hadoop MapReduce job to write the output to a MySQL database. Following the example from the connector repository:

      job.setMapperClass( TokenizerMapper.class );
      job.setCombinerClass( IntSumReducer.class );
      job.setReducerClass( IntSumReducer.class );
      job.setOutputKeyClass( Text.class );
      job.setOutputValueClass( IntWritable.class );
      job.setInputFormatClass( MongoInputFormat.class );
      /* Instead of:
       * job.setOutputFormatClass( MongoOutputFormat.class );
       * we use an OutputFormatClass that writes the job results 
       * to a MySQL database. Beware that the following OutputFormat 
       * will only write the *key* to the database, but the principle
       * remains the same for all output formatters
       */
      job.setOutputFormatClass( DBOutputFormat.class );
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Summary Hi All, OK, further into my adventures with custom controls... In summary, here
Summary I am after some advice on the easiest way to analyze simple data
Summary: I want to know if it is possible to do something like this:
Summary: is it possible to specify a port to use when querying WMI using
Summary I want to write a .png file as quickly as possible, without a
Is it possible to get jquery validation to show the validation summary using eager
I do know that it is possible to customize the Build summary of a
Is it possible to have a report which has grouping on the underlying data
Possible Duplicate: Auditing SQL Server data changes My requirements demand for each row inserted
In SSRS 2008, is it possible load detail report from summary report automatically? The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.