MongoDB rs.initiate hangs

mongodb

I am having trouble setting up replication on a new mongoDB installation. Everything works fine when I run without replication but when I run mongod with the –replSet option, and run rs.initiate(), this command hangs. Note that I am only running a single instnace of mongod in this example. No other instances are yet running.

In the logfile, I see:

Wed Aug 15 10:02:04 [conn2] run command admin.$cmd { replSetInitiate: { _id: "regression_data", members: [ { _id: 0.0, host: "nradmin.icd.teradyne.com:27017" } ] } }
Wed Aug 15 10:02:04 [conn2] command: { replSetInitiate: { _id: "regression_data", members: [ { _id: 0.0, host: "nradmin.icd.teradyne.com:27017" } ] } }
Wed Aug 15 10:02:04 [conn2] replSet replSetInitiate admin command received from client
Wed Aug 15 10:02:04 [conn2] replSet replSetInitiate config object parses ok, 1 members specified
Wed Aug 15 10:02:04 [conn2] replSet replSetInitiate all members seem up
Wed Aug 15 10:02:11 [conn1] runQuery called local.system.replset {}
Wed Aug 15 10:02:21 [rsStart] Socket recv() timeout  127.0.0.1:27017
Wed Aug 15 10:02:21 [rsStart] SocketException: remote: 127.0.0.1:27017 error: 9001 socket exception [3] server [127.0.0.1:27017]
Wed Aug 15 10:02:21 [rsStart] DBClientCursor::init call() failed
Wed Aug 15 10:02:21 [rsStart] User Assertion: 10276:DBClientBase::findN: transport error: localhost:27017 query: {}
Wed Aug 15 10:02:21 [rsStart] runQuery called local.system.replset {}

I have played with the bind_ip option a bit but had no luck.

Here is my current config file:

dbpath = /hwnet/mongodb/regression_data/replica0
replSet = regression_data/nradmin.icd.teradyne.com
logpath = /hwnet/mongodb/regression_data/mongodb_r0.log
verbose = true
vvvvv = true
rest = true
fork = true

This is running on my work network. I did try the same setup on a standalone Mac installation and the rs.initiate() command works perfectly.

Does anyone have any idea what I should be looking at here? I'm running out of ideas.

Best Answer

I was able to get a solution for this problem on the mongoDB google group. Explicitly setting the oplogSize parameter in my config file solved the problem. By default, mongod tries to allocate 5% of the free space on the storage partition. I have my data on a very large shared disk and this seemed to be taking a long time. I manually set this value and the replica set came up quickly.