MongoDB - setting up replica

1,291 views
Skip to first unread message

Gopinath Rajee

unread,
Mar 17, 2018, 12:04:16 PM3/17/18
to mongodb-user
All,

I have two "standalone" MongoDB V3.6.3 instances on Windows at home. I wanted to enable replication between them and add another node once I get the two done.

I have the following computers for now and note that all these standalone instances have databases in them that I have been playing with. I don't have a problem with getting rid of the databases in the secondary if there is a need.

Desktop PC : TheWho --> Will be the Primary
Dell Laptop : Dell-Latitude --> Will be the Secondary
HP PC : HP-Basement --> Will work on converting this to Secondary once I'm done with Dell-Latitude.


I setup the Primary on the "TheWho" by following the link - Convert a Standalone to a Replica Set  as in the manual. 

Now, I tried adding Dell-Latitude by following the link Add Members to a Replica Set but I'm getting the error

MongoDB Enterprise HomeRepl:PRIMARY> rs.add( { host: "Dell-Latitude" } )
{
        "ok" : 0,
        "errmsg" : "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: TheWho:27017; the following nodes did
 not respond affirmatively: Dell-Latitude:27017 failed with Cache Reader No keys found for HMAC that is valid for time: { ts: Timestamp(1521299700, 1) } with id:
 6533307377964285953",
        "code" : 74,
        "codeName" : "NodeNotFound",
        "operationTime" : Timestamp(1521299700, 1),
        "$clusterTime" : {
                "clusterTime" : Timestamp(1521299700, 1),
                "signature" : {
                        "hash" : BinData(0,"BV2syVHOpazX3E/+6IqiDXKsY+k="),
                        "keyId" : NumberLong("6533307377964285953")
                }
        }
}
 
What am I doing wrong? 

Thank,
grajee

Gopinath Rajee

unread,
Mar 17, 2018, 12:09:58 PM3/17/18
to mongodb-user
Somemore info:


MongoDB Enterprise HomeRepl:PRIMARY> rs.status()
{
       
"set" : "HomeRepl",
       
"date" : ISODate("2018-03-17T16:07:28.843Z"),
       
"myState" : 1,
       
"term" : NumberLong(4),
       
"heartbeatIntervalMillis" : NumberLong(2000),
       
"optimes" : {
               
"lastCommittedOpTime" : {
                       
"ts" : Timestamp(1521302840, 1),
                       
"t" : NumberLong(4)
               
},
               
"readConcernMajorityOpTime" : {
                       
"ts" : Timestamp(1521302840, 1),
                       
"t" : NumberLong(4)
               
},
               
"appliedOpTime" : {
                       
"ts" : Timestamp(1521302840, 1),
                       
"t" : NumberLong(4)
               
},
               
"durableOpTime" : {
                       
"ts" : Timestamp(1521302840, 1),
                       
"t" : NumberLong(4)
               
}
       
},
       
"members" : [
               
{
                       
"_id" : 0,
                       
"name" : "TheWho:27017",
                       
"health" : 1,
                       
"state" : 1,
                       
"stateStr" : "PRIMARY",
                       
"uptime" : 33634,
                       
"optime" : {
                               
"ts" : Timestamp(1521302840, 1),
                               
"t" : NumberLong(4)
                       
},
                       
"optimeDate" : ISODate("2018-03-17T16:07:20Z"),
                       
"electionTime" : Timestamp(1521269244, 1),
                       
"electionDate" : ISODate("2018-03-17T06:47:24Z"),
                       
"configVersion" : 3,
                       
"self" : true
               
}
       
],
       
"ok" : 1,
       
"operationTime" : Timestamp(1521302840, 1),
       
"$clusterTime" : {
               
"clusterTime" : Timestamp(1521302840, 1),
               
"signature" : {
                       
"hash" : BinData(0,"qOXbSOsemSr9cqkFJ5d7Jydmzh4="),
                       
"keyId" : NumberLong("6533307377964285953")
               
}
       
}
}
MongoDB Enterprise HomeRepl:PRIMARY>

                                      

Gopinath Rajee

unread,
Mar 17, 2018, 5:45:31 PM3/17/18
to mongodb-user
I tried it on the HP-Basement desktop as well and I got the same error when I run rs.add({ host: HP-Basement}). I looked at the log files in both the Dell and HP instances and saw the same below error :

"Did not find local replica set configuration document at startup;  NoMatchingDocument: Did not find replica set configuration document in local.system.replset"

Looks like I'm missing something very fundamental. Please help!!

Thanks,
grajee




On Saturday, March 17, 2018 at 12:04:16 PM UTC-4, Gopinath Rajee wrote:

Max

unread,
Mar 18, 2018, 5:16:23 PM3/18/18
to mongodb-user
Hi,
what are you using in order ton configure your replica set?
Are you using a configuration file for that or are you starting MongoDB process manually ?
Best regards
Max

Kevin Adistambha

unread,
Mar 29, 2018, 1:01:53 AM3/29/18
to mongodb-user

Hi,

From the error message you posted:

Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: TheWho:27017; the following nodes did

not respond affirmatively: Dell-Latitude:27017 failed with Cache Reader No keys found for HMAC that is valid for time: ….

I believe the cause of the error is that TheWho cannot find Dell-Latitude by name.

Could you try pinging Dell-Latitude and HP-Basement from TheWho (and vice versa)?

If you find that all the machines cannot find each other using ping, you might want to add all the machine’s IP addresses into the Hosts file in each machine.

Best regards
Kevin

Reply all
Reply to author
Forward
0 new messages