Configuring replica set

1,180 views
Skip to first unread message

Kevin Burton

unread,
Dec 11, 2012, 10:43:05 AM12/11/12
to mongod...@googlegroups.com
I am following http://www.mongodb.org/display/DOCS/MongoDB+on+Azure+VM+-+Linux+Tutorial and I am at the section 'Configuring the Replica set'. There seems to be some typos in the text that is to be typed in. First I don't think the quotes match. If typed in as specified you always get '...' like the shell is still expecting input. Second, with the line 'id =' it should be 'id :' or you get:

Tue Dec 11 15:27:37 SyntaxError: missing : after property id (shell):2

Finally, (and this is what I need help on), I am getting:

Tue Dec 11 15:30:23 SyntaxError: illegal character (shell):4

I am not sure which of the characters is illegal. Would someone be so kind as to post the correct 'script' text to set up a replication set?

Also once this is entered it is persisted, right? Does this need to be correctly entered before the configuration value replSet = mongors will work? I was getting errors so I just commented this line out but now I see that I may need to add it back in. It seems kind of a Catch-22 in that the MongoDB server will not start if the configuration line is in place as it claims that it cannot find xxx and the mongo shell needs to connect to a running MongoDB server. So the running MongoDB server will not have this property set when it starts up.

Kevin Burton

unread,
Dec 11, 2012, 11:06:54 AM12/11/12
to mongod...@googlegroups.com
I ran into a different problem an this is definitely a Catch-22. Since I commented out the line 'replSet="mongors"' so the server will start, now when I try to configure the replication set I get:

> rs.initiate(conf)
{ "errmsg" : "server is not running with --replSet", "ok" : 0 }

Now what?

Russell Bateman

unread,
Dec 11, 2012, 11:20:13 AM12/11/12
to mongod...@googlegroups.com
I'm as interested as you in how this should be done correctly. I do have a replica set up and running experimentally as described here.

What I want to know is how the real boys in the data center would set this stuff up rather than the cowboy, ad hoc way I did it using information from the web page.

(We can always hope.)
--
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
See also the IRC channel -- freenode.net#mongodb

Kevin Burton

unread,
Dec 11, 2012, 12:08:28 PM12/11/12
to mongod...@googlegroups.com
Maybe you can help me get a little further. The problem that I am facing is that with the line 'replSet="mongors"' in app.config the server will not start (it errors out). The instructions indicate that you should connect to a running server. But when I try to configure the replica set I get an error that replSet is not enabled. So when you configured your replica set did did you set the replSet line in the configuration. If so how did you get around the server not starting? Did you put a place holder somewhere so that the server would start with this configuration line? You see when the configuration line is not commented out I get:

Tue Dec 11 05:36:30 [rsStart] replSet can't get local.system.replset config from
 self or any seed (EMPTYCONFIG)

I get this error a number of times then eventually it causes a catastrophic error and the server goes down.

Also the instruction call the mongo shell without '--host'. I see that you call it with this argument. Are they missing something?

Thank you.

Kevin Burton

unread,
Dec 11, 2012, 12:39:58 PM12/11/12
to mongod...@googlegroups.com
It would be interesting if the docs would include the necessary mongod.conf and init.d scripts so that an arbiter is setup correctly. This replica set that is setup does not have an arbiter.

Russell Bateman

unread,
Dec 11, 2012, 12:39:27 PM12/11/12
to mongod...@googlegroups.com
Note that I used two hosts (two physical pieces of ancient, craptastic hardware running Natty) for two replica nodes, four nodes in all plus an arbiter I planned to set up all along. I was just playing around. And this is still running after a couple of months now.

I establish the replSet inside mongodb.conf for each node, yes. By "server not starting" do you mean the replica node mongod? It started, that's all. No placeholder(s); I had the two mongodb.conf files for one host's replicas. Don't be confused by the bash scripts; they were just me thinking I'd want to do the same thing in two places and later would want to use something to administer the replica set nodes.

I assume you're not trying to make a replica out of the mongod running as a service (you didn't say which platform you're running on). I run separate mongods, not including the "main" mongod service running on each host, which I ignored out of fascination that I could do that and all three mongods would just not bother each other. Cheap thrills.

The --host argument when launching is how to ensure in the shell you're seeing the particular, remote replica node rather than another mongod. --port is how the shell really knows what you're talking about. The host arguments are tied together via explicit entries in both hosts /etc/hosts files.

All my scrapes from the console and from the shell are there.

I hope my example wasn't too confusing. I did it to get the "stoopids" out before I do it for real, here very soon. Now that I've done it, I'm convinced I don't know how to do it for real, the way a sysadmin would. I know that I can do it, just not "professionally" and I want to learn that.

Russ

Russell Bateman

unread,
Dec 11, 2012, 12:50:35 PM12/11/12
to mongod...@googlegroups.com
Yeah, you're supposed to synthesize the learning. That's why I did the experiment: to see if I grok'd. The forum here is pretty responsive, however. They're just waiting for me to shut up, then they'll start giving you real, expert help.

:-)

Best,

Russ

Kevin Burton

unread,
Dec 11, 2012, 1:10:50 PM12/11/12
to mongod...@googlegroups.com
The docs say I should ignor the warning/error and when I include the replSet configuration line I get lots of messages but it seems the server stays up. Now I am getting the error:

> rs.initiate(conf)
{
        "errmsg" : "couldn't initiate : set name does not match the set name host bsicentos.cloudapp.net:27019 expects",
        "ok" : 0
}

I am not sure what the set name should be. Any suggestions?

Russell Bateman

unread,
Dec 11, 2012, 1:16:49 PM12/11/12
to mongod...@googlegroups.com
What does rs.conf() yield?

Jason Lewis

unread,
Dec 11, 2012, 1:28:41 PM12/11/12
to mongod...@googlegroups.com
The host you ran rs.initiate(conf) doesn't know the hostname/ip of
what you configured.

I found it easier to add entries to /etc/hosts so each server knew the
others by name name and ip.

ex.

mongo1 192.168.1.1
mongo2 192.168.1.2
mongo3 192.168.1.3

Then during config, rs.add("mongo1:27017")....etc.

Jonny86

unread,
May 22, 2015, 6:48:27 PM5/22/15
to mongod...@googlegroups.com
Hi All,

I am trying to add a replica set but I am getting the below error message. Any help will be greatly appreciated.

mongo1:PRIMARY> rs.add("10.18.2.40:27017")
{
        "errmsg" : "exception: need most members up to reconfigure, not ok : 10.18.2.40:27017",
        "code" : 13144,
        "ok" : 0
}

I am using version 2.6.10-1 . 

Asya Kamsky

unread,
May 25, 2015, 11:35:28 AM5/25/15
to mongodb-user

Please start a new topic rather than responding to an old thread so it will be clear what your issue is.

Please post your existing replica set configuration (rs.conf()) and status (rs.status()) output as that will likely show what the issue is.

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/428d1e2b-97f0-4ad5-aefe-c7e5931e7083%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages