replica set couldn't initiate

1,221 views
Skip to first unread message

andreacfm

unread,
Aug 3, 2011, 11:17:54 AM8/3/11
to mongodb-user
Hi
I am setting up my replica set on localhost trying to understand how
to automate the config.
Btw
I set up 3 nodes (1 arbiter) like:

mongod --replSet development --port 27017 --dbpath /usr/local/var/
mongodb/r1/ --rest
mongod --replSet development --port 27018 --dbpath /usr/local/var/
mongodb/r2/ --rest
mongod --replSet development --port 27019 --dbpath /usr/local/var/
mongodb/r3/ --rest

All nodes run just fine.

I am then trying to load my replica config reading a js file:

mongo replica_start.js

the js file looks like this:

config = {_id: 'development', members: [{_id: 0, host: 'localhost:
27017'},{_id: 1, host: 'localhost:27018'},{_id: 2, host: 'localhost:
27019', arbiterOnly: true}]}
rs.initiate(config);

While nothing was happening calling the js I then tried to initiate
running the sams code into a shell and I get this error:

"errmsg" : "couldn't initiate : nonmatching repl set name in _id
field; check --replSet command line",
"ok" : 0

I never saw this before.

Any suggestion?

I am on osx lion mongodb 1.8.2

Thanks

Andrea

Nat

unread,
Aug 3, 2011, 12:11:12 PM8/3/11
to mongod...@googlegroups.com
Can you check the config sent to the server in your mongod log?

andreacfm

unread,
Aug 4, 2011, 11:53:32 AM8/4/11
to mongodb-user
My logs just show this:

Thu Aug 4 17:51:46 [conn4] replSet replSetInitiate admin command
received from client
Thu Aug 4 17:51:46 [conn4] replSet replSetInitiate config object
parses ok, 3 members specified
Thu Aug 4 17:51:46 [conn4] replSet replSetInitiate all members seem
up
Thu Aug 4 17:51:46 [conn4] replSet replSetInitiate exception:
nonmatching repl set name in _id field; check --replSet command line
Thu Aug 4 17:51:46 [conn4] end connection 127.0.0.1:53396


Any suggestion?

Andrea

andreacfm

unread,
Aug 4, 2011, 12:00:04 PM8/4/11
to mongodb-user
I tried to delete all ny data folder and restart anything from
scratch.
I now find more in my log:

Thu Aug 4 17:57:25 [conn4] replSet replSetInitiate admin command
received from client
Thu Aug 4 17:57:25 [conn4] replSet replSetInitiate config object
parses ok, 3 members specified
Thu Aug 4 17:57:25 [conn4] replSet replSetInitiate all members seem
up
Thu Aug 4 17:57:25 [conn4] ******
Thu Aug 4 17:57:25 [conn4] creating replication oplog of size:
183MB...
Thu Aug 4 17:57:25 [FileAllocator] allocating new datafile /usr/local/
var/mongodb/r1/local.ns, filling with zeroes...
Thu Aug 4 17:57:25 [FileAllocator] done allocating datafile /usr/
local/var/mongodb/r1/local.ns, size: 16MB, took 0.009 secs
Thu Aug 4 17:57:25 [FileAllocator] allocating new datafile /usr/local/
var/mongodb/r1/local.0, filling with zeroes...
Thu Aug 4 17:57:26 [FileAllocator] done allocating datafile /usr/
local/var/mongodb/r1/local.0, size: 64MB, took 0.307 secs
Thu Aug 4 17:57:26 [FileAllocator] allocating new datafile /usr/local/
var/mongodb/r1/local.1, filling with zeroes...
Thu Aug 4 17:57:27 [FileAllocator] done allocating datafile /usr/
local/var/mongodb/r1/local.1, size: 128MB, took 0.263 secs
Thu Aug 4 17:57:28 [FileAllocator] allocating new datafile /usr/local/
var/mongodb/r1/local.2, filling with zeroes...
Thu Aug 4 17:57:28 [FileAllocator] done allocating datafile /usr/
local/var/mongodb/r1/local.2, size: 256MB, took 0.464 secs
Thu Aug 4 17:57:32 [conn4] ******
Thu Aug 4 17:57:32 [conn4] replSet replSetInitiate exception:
nonmatching repl set name in _id field; check --replSet command line
Thu Aug 4 17:57:32 [conn4] query admin.$cmd ntoreturn:1 command:
{ replSetInitiate: { _id: "development", members: [ { _id: 0.0, host:
"localhost:27017" }, { _id: 1.0, host: "localhost:27018" }, { _id:
2.0, host: "localhost:27019", arbiterOnly: true } ] } } reslen:154
6396ms
Thu Aug 4 17:57:32 [conn2] query admin.$cmd ntoreturn:1 command:
{ listDatabases: 1 } reslen:249 1606ms
Thu Aug 4 17:57:32 [startReplSets] replSet can't get
local.system.replset config from self or any seed (EMPTYCONFIG)
Thu Aug 4 17:57:32 [conn4] end connection 127.0.0.1:53482
Thu Aug 4 17:57:42 [startReplSets] replSet can't get
local.system.replset config from self or any seed (EMPTYCONFIG)

Do I have to return something from the js code that execute the
rs.initiate() ?

Thanks

On Aug 3, 6:11 pm, Nat <nat.lu...@gmail.com> wrote:

andreacfm

unread,
Aug 5, 2011, 2:47:15 AM8/5/11
to mongodb-user
Anyone on this?

Thanks

Andrea

Nat

unread,
Aug 5, 2011, 2:53:54 AM8/5/11
to mongod...@googlegroups.com
problem was that it seems like you had configured replSet previously. That's probably why it doesn't work. If you delete local.* from every box, restart it and rerun your script, it should work. Otherwise, you may use reconfig() instead.
Reply all
Reply to author
Forward
0 new messages