[mongodb-user] Replica Pairs - { "errmsg" : "not master", "ok" : 0 }

221 views
Skip to first unread message

zopyfilter

unread,
Apr 18, 2010, 11:20:24 AM4/18/10
to mongod...@googlegroups.com
Playing with replica pair support using MongoDB on a local machine.

Both parts were started using:

mongod --pairwith localhost:27018 --dbpath /tmp/db/left
mongod --pairwith localhost:27017 --dbpath /tmp/db/right --port 27018

According to the logs the pairing seems to be fine.

Then I tried to insert data through some Python script to the instance
running 27017...got a complaint that this is would not be the
master...ok...insertions on port 27018 worked.

Then I tried to query a collection on both ports which fails with the
error given in the subject:

ajung@blackmoon:~/src/mongo-bench> mongo
MongoDB shell version: 1.4.0
url: test
connecting to: test
type "help" for help
> db.my_collection.find().count()
Sun Apr 18 17:17:49 JS Error: uncaught exception: count failed: {
"errmsg" : "not master", "ok" : 0 }


ajung@blackmoon:~/src/mongo-bench> mongo -p 27018
MongoDB shell version: 1.4.0
url: test
connecting to: test
type "help" for help
> db.my_collection.find().count()
Sun Apr 18 17:18:01 JS Error: uncaught exception: count failed: {
"errmsg" : "not master", "ok" : 0 }

Then I tried asking on both ports who the master is:

ajung@blackmoon:~/src/mongo-bench> mongo -p 27017
MongoDB shell version: 1.4.0
url: test
connecting to: test
type "help" for help
> db.$cmd.findOne({ismaster:1});
{
"ismaster" : 0,
"remote" : "localhost:27018",
"info" : "direct negotiation",
"ok" : 1
}


ajung@blackmoon:~/src/mongo-bench> mongo -p 27018
MongoDB shell version: 1.4.0
url: test
connecting to: test
type "help" for help
> db.$cmd.findOne({ismaster:1});
{
"ismaster" : 0,
"remote" : "localhost:27018",
"info" : "direct negotiation",
"ok" : 1



ismaster=0 on both instances appears weird - what's going on here?

Andreas

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

Michael Dirolf

unread,
Apr 18, 2010, 12:29:17 PM4/18/10
to mongod...@googlegroups.com
the mongo shell doesn't take -p as an argument to set the port, not
sure where you saw that (try mongo --help to see available options)

to connect to port 27018 use `mongo localhost:27018`

filtered

unread,
Apr 18, 2010, 1:37:31 PM4/18/10
to mongod...@googlegroups.com
Right - my fault.

Related to replica pairs: can a replica pair be used as a master for a master-slave setup?

The idea is to have read-only slave for all front-end application servers and replica-pair for the writes in the backend.

-aj

2010/4/18 Michael Dirolf <mi...@10gen.com>

Michael Dirolf

unread,
Apr 18, 2010, 1:39:32 PM4/18/10
to mongod...@googlegroups.com
Can't do that - but replica sets will have this sort of functionality
built-in and will fix a lot of the issues that currently exist w/
replica pairs:

http://www.mongodb.org/display/DOCS/Replica+Set+Internals

filtered

unread,
Apr 18, 2010, 1:42:35 PM4/18/10
to mongod...@googlegroups.com
Replica sets are already part of the nightly builds or the 1.5 version?

Andreas

2010/4/18 Michael Dirolf <mi...@10gen.com>

Kristina Chodorow

unread,
Apr 18, 2010, 1:44:02 PM4/18/10
to mongod...@googlegroups.com
Not yet.  They'll be added in 1.5 series and be production ready in the 1.6 release.
Reply all
Reply to author
Forward
0 new messages