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 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.

share|improve this question

migrated from stackoverflow.com Aug 16 '12 at 15:37

This question came from our site for professional and enthusiast programmers.

    
Did you try using localhost instead of 127.0.0.1? –  Asya Kamsky Aug 15 '12 at 15:38
    
@asya I don't explicitly call out 127.0.0.1 anywhere in the config file. I'm not sure where I could make this change. From my understanding, the bind_ip option requires a real IP address. I did try to explicitly set this to 127.0.0.1 as well as point it to a DNS server. The first case made no difference and the latter case caused mongod to crash and never really get running. –  Bill Peregoy Aug 15 '12 at 18:38

2 Answers 2

First of all - why do you make a replica set composed of only one member ? Replica sets are meant to add redundancy ... you can't really do it with one member.

Second from the log you sent looks like the server doesn't respond anymore.

Be aware that at the initiation time a replica set will try to pre-allocate up to 5% for the capped collection - oplog on 64 bits systems. So if you have a large disk wait until all files are allocated - filled with zeros :). To tune it use --oplogSize.

share|improve this 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.

share|improve this answer

Your Answer

 
discard

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