5

I'm trying to create a replica set in MongoDB version 3.04. I followed this tutorial and getting the next error while trying to add nodes using the primary server:

vacrep:PRIMARY> rs.add('server address here')
{
    "ok" : 0,
    "errmsg" : "Quorum check failed because not enough voting nodes responded;
     required 2 but only the following 1 voting nodes responded: PRIMARYSERVER:27017; 
     the following nodes did not respond affirmatively: 'server address here':27017 
     failed with Missing credentials for authenticating as internal user",
     "code" : 74
}

This is what been done so far:

  1. Install 3 servers with MongoDB 3.04
  2. Run all MongoDB instances with repSet mode
  3. Verified connectivity between servers using this approach
  4. Initiate a replica in the primary server)

I found few threads about this error no but couldn't find a solution in any of them. How can I solve this?

Ofir
  • 181
  • 1
  • 1
  • 6

2 Answers2

3

Found the solution - It was permission issue.

In MongoDB configuration file, I had to turn off authentication mode or create a shared key between all nodes using this guide:

https://docs.mongodb.com/manual/tutorial/deploy-replica-set-with-keyfile-access-control/#deploy-repl-set-with-auth

This was the reason my servers couldn't communicate each other.

Ofir
  • 181
  • 1
  • 1
  • 6
  • 1
    the link is outdated, this is the current doc page https://docs.mongodb.com/manual/tutorial/deploy-replica-set-with-keyfile-access-control/#deploy-repl-set-with-auth – alfredopacino Nov 17 '16 at 16:16
0

In addition to the above answer which is obviously correct, The following steps will be helpful in creation of the keyFiles :

  1. Open new tab in any text editor, paste any random key you want without any spaces.

  2. Save the file with no extension

  3. Shutdown the each mongo instance as follows :

    a. use admin

    b. db.shutdownServer();

  4. Now restart the mongo instances with keyFile as argument.

    e.g. start "jaguar" mongod --dbpath "D:\Mongo\data\Replica Sets\Jaguar" --port 50000 --replSet "clusterset" --keyFile "D:\Mongo\data\Replica Sets\Jaguar\Key\F2AB9B2DCF7933733A35EE9C81C34"