[SERVER-4393] Adding member in replica by hostname fails Created: 30/Nov/11  Updated: 28/Oct/19  Resolved: 01/Dec/11

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 2.0.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Dmytro Korsakov Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 10.04


Operating System: Linux
Participants:

 Description   

For each node in replica set we have hostnames (mongo-0-0 for master, mongo-0-1 for the first slave and so on) in /etc/hosts.
And when trying to add a slave to set using hostnames, we always get this particular error:

'need most members up to reconfigure, not ok : mongo-0-1:27018', assertionCode: 13144

The problem occurs only in case /etc/hosts is modified after mongod process was started on the master node.

Although if we use IP-addresses instead of hostnames, or hack /etc/hosts before starting master's mongod, or if we simply restart mongod when manipulating with /etc/hosts is done everything seems to be alright, replication process begins and we get no errors.

But unfortunately neither is acceptable for our setup.



 Comments   
Comment by Githook User [ 28/Oct/19 ]

Author:

{'name': 'Mark Benvenuto', 'username': 'markbenvenuto', 'email': 'mark.benvenuto@mongodb.com'}

Message: SERVER-4393 Remove cpplint.py and lint.py
Branch: master
https://github.com/mongodb/mongo/commit/1e23641536f0b2e3632e11e40e35bf017b4f5e64

Comment by Githook User [ 28/Oct/19 ]

Author:

{'username': 'markbenvenuto', 'email': 'mark.benvenuto@mongodb.com', 'name': 'Mark Benvenuto'}

Message: SERVER-4393 Remove cpplint.py and lint.py
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/949826f4869580fd3a14838f08d104194c2a578b

Comment by Kristina Chodorow (Inactive) [ 01/Dec/11 ]

You can do it in any order so long as the new set has a majority of servers up. You're right, the documentation didn't go into this very well, I added clarification to http://www.mongodb.org/display/DOCS/Adding+a+New+Set+Member.

Comment by Dmytro Korsakov [ 01/Dec/11 ]

Looks like we misinterpreted documentation.

Answering your question,
1. on machine A I change /etc/hosts to be mongo-0-0
2. on machine A I start a primary
3. on machine A I add secondary's (B) ip as host 'mongo-0-1' to /etc/hosts
4. on machine A I check that mongo-0-1 resolves ok
5. on machine A I register a secondary (B) by hostname mongo-0-1
At that moment I get the error message
6. Script starts a secondary on machine B
By the time I get error and try IP instead of hostname the script does №6 and test passes.

Now we start secondary process before registering it on primary and it works just fine with both IPs and hostnames.

Mongo documentation states that using 2.0+ I can do it in any order, but there seems to be an exception: the 1st secondary cannot be registered on primary before secondary's process brought up because there is no majority running and if some decide to add unexisting replica to such set, he will need to do it with

{force:true}

.

Comment by Kristina Chodorow (Inactive) [ 30/Nov/11 ]

I'm not exactly clear on what you're doing, can you confirm:

  • You start a primary on a machine (A).
  • You change A's /etc/hosts to be mongo-0-0
  • You add a secondary (B)
  • You change B's /etc/hosts to be mongo-0-1
  • You try to add another member and get the "need most members up" error

Is that correct?

Can you run with -vvv and attach the log from the primary, too?

Generated at Thu Feb 08 03:05:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.