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 8622401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:02:45+00:00 2026-06-12T07:02:45+00:00

I am inserting documents into MongoDB from a map in a MapReduce job. A

  • 0

I am inserting documents into MongoDB from a map in a MapReduce job. A bunch of strings are given to the map and it generates SHA-1 message for each string and inserts them into MongoDB. There are about 400 million strings (reading from files on HDFS). I am using 10 shards with 3 mongos and no replication. I’m using MongoDB 2.2.0 on 64 bit linux. However, this MR job does not get completed and I see the following 2 types of exceptions in the logs.

  1. Too many connections to each shard in MongoDB (around 250 connections). I see the following exception in the logs

    com.mongodb.DBTCPConnector fetchMaxBsonObjectSize                                                                                                                                 
    WARNING: Exception determining maxBSONObjectSize                                                                                                                                                          
    java.net.SocketException: Connection reset 
    
  2. Task attempt_***** failed to report status for 600 seconds. Killing!

There are 16 nodes in the cluster and at any time there seems to be 256 map tasks running (noticed it in hadoop logs).

I searched around for the first error/exception and someone mentioned that the number of connections per host for MongoDB has to be increased. I increased that to 20 from 10 using MongoOptions class and provide that while initializing Mongos instance. But that hasn’t solved the issue — is this the reason for the exception?

I am creating an instance of Mongo in configure() method of map() and closing it in close(). Are there any better ways to create Mongo instances?

Did anyone come across these errors when working on Hadoop + MongoDB combination? Is there anything else that I need to be aware of while using this combination?

PS: I posted this question to MongoDB user list, but wanted to get a wider audience check this question, so reposted it here.

  • 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-12T07:02:47+00:00Added an answer on June 12, 2026 at 7:02 am

    Check the value of ulimit -n on your hosts. It sounds like you could be hitting a file descriptor limit on your machines.

    In general though, using a driver connection to store documents in Mongo during a MapReduce job is an anti-pattern. You’re better off having the mapreduce output just produce documents with the data you need, rather than trying to create additional connections to Mongo and write more data out-of-band.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm inserting documents using node mongodb native driver into a mongodb (sic!). My objects
For example, there are 5 object stores. I am thinking of inserting documents into
When inserting copy into an HTML document I get from sources such as word
I am inserting some xml documents from the UI in Marklogic Server and at
I have a problem inserting the values from checkboxes in an html document into
I'm basically inserting information from a dataset into an excel document. We really don't
I'm parsing text documents and inserting them into PostgreSQL DB. My code is written
Inserting rows one by one from a 600 record data-set is taking almost an
When inserting a row into a table with an auto increment primary key column,
Before inserting data into table i need to check against duplicate records and report

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.