Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm trying to clone a MongoDB collection from CentOS server A to CentOS server B. Both are running 2.4.6. The copy works great until exaxctly 2 hours, at which point I get a 9001 socket exception: "errno:10054 An existing connection was forcibly closed by the remote host."

I have tried to set the tcp_keepalive_time to 3600, down from 7200 (2 hours) on both servers with the hope that my keep alive probes will tell routers to keep my connection alive after the 1 hour mark.

No dice. Even with a shorter keepalive time (and 70 second interval for keepalive probes), my connection dies at 2 hours.

Does anyone know how to set up my servers and/or my mongodb configuration to allow my tcp connection to be active past 2 hours?

Thanks!

share|improve this question

1 Answer 1

The connection being killed after 2 hours, even when active (keepalive would only come into play for an idle connection, which is why it had not impact on your issue), suggests that this is a firewall or similar in the path between the two servers that is killing the connection. You either need an exception to that rule from your network admin or you need to figure out a different way to copy the data, preferably one that can resume following an interruption.

The easiest alternative I can think of is to use mongodump to dump out the collection locally on the first MongoDB instance, SCP/FTP the files (with a client that supports resuming transfers) to the second machine, then use mongorestore to load the collection locally into the second MongoDB instance.

share|improve this answer
    
Great thanks for this. I think my first step will be to disable the firewall on the accepting machine and trying the connection again for test purposes. In your opinion, do I need to disable the firewall on both machines (outgoing and incoming)? –  kmehta Oct 8 '13 at 13:55
    
You might be able to determine that by looking at a trace on the connection that gets killed (see what is sending the RST or whatever is killing the connection). Unless you have that trace handy, that process will probably take as long as simply running the command again with one firewall off to see which one it is. One thing to remember, if you don't own every hop in between it can be something else in the middle that kills any connection more than 2 hours. –  Adam C Oct 9 '13 at 0:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.