Master Master Replication - java driver problem

30 views
Skip to first unread message

Cheenu

unread,
Jun 17, 2010, 6:41:21 PM6/17/10
to mongodb-user
I am trying to get Master-Master replication to be accessed via Java
driver
I have setup as per http://www.mongodb.org/display/DOCS/Master+Master+Replication,
and everything as stated in that doc works

But Java driver has a problem:
Jun 17, 2010 5:17:35 PM com.mongodb.DBTCPConnector _pickInitial
SEVERE: switched to: localhost:27018 but isn't master
Jun 17, 2010 5:17:36 PM com.mongodb.DBTCPConnector _pickInitial
SEVERE: can't pick initial master, using random one
com.mongodb.MongoException: can't find master
at com.mongodb.DBTCPConnector._pickInitial(DBTCPConnector.java:362)
at com.mongodb.Mongo.<init>(Mongo.java:159)
at com.mongodb.Mongo.<init>(Mongo.java:145)

Java driver seems to use this to figure out which is master:
db.$cmd.findOne({ismaster:1})

But, neither are master as per:
$/opt/mongodb-1.5.3/bin/mongo localhost:27017 --eval "printjson(db.\
$cmd.findOne({ismaster:1}));"
MongoDB shell version: 1.5.3
connecting to: localhost:27017/test
{ "ismaster" : 0, "msg" : "not paired", "ok" : true }

$/opt/mongodb-1.5.3/bin/mongo localhost:27018 --eval "printjson(db.\
$cmd.findOne({ismaster:1}));"
MongoDB shell version: 1.5.3
connecting to: localhost:27018/test
{ "ismaster" : 0, "msg" : "not paired", "ok" : true }

Any ideas on what can be done?

Thanks
Cheenu

Michael Dirolf

unread,
Jun 17, 2010, 6:45:30 PM6/17/10
to mongod...@googlegroups.com
Can you paste the commands you used to start the two servers?

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>

Cheenu

unread,
Jun 18, 2010, 7:40:14 AM6/18/10
to mongodb-user
/opt/mongodb-1.5.3/bin/mongod --port 27017 --dbpath /opt/tmp/
mongodbdata --master --slave --source localhost:27018 --rest

/opt/mongodb-1.5.3/bin/mongod --port 27018 --dbpath /opt/tmp/
mongodbdata2 --master --slave --source localhost:27017 --rest

Michael Dirolf

unread,
Jun 18, 2010, 10:29:17 AM6/18/10
to mongod...@googlegroups.com
Okay I can reproduce this. Seems to me that ismaster should be true
when running w/ both --master and --slave. Mind opening a jira for
this?

Reply all
Reply to author
Forward
0 new messages