1

mongo primary is showing behind the primary ?? Its increasing as time passes . Please suggest ?

monRepl:PRIMARY> rs.printSlaveReplicationInfo()
source: xxxxxx:27017
    syncedTo: Mon Apr 27 2015 10:39:02 GMT+0530 (IST)
    **25835 secs (7.18 hrs) behind the primary** 

monRepl:PRIMARY> rs.status();
{
    "set" : "monRepl",
    "date" : ISODate("2015-04-27T12:20:38Z"),
    "myState" : 1,
    "members" : [
        {
            "_id" : 3,
            "name" : "xxxxx:27017",
            "health" : 1,
            "state" : 2,
            "stateStr" : "SECONDARY",
            "uptime" : 329104,
            "optime" : Timestamp(1430111629, 90),
            "optimeDate" : ISODate("2015-04-27T05:13:49Z"),
            "lastHeartbeat" : ISODate("2015-04-27T12:20:36Z"),
            "lastHeartbeatRecv" : ISODate("2015-04-27T12:20:37Z"),
            "pingMs" : 0,
            "syncingTo" : "yyyyyy:27017"
        },
        {
            "_id" : 5,
            "name" : "xxxxxx:27017",
            "health" : 1,
            "state" : 7,
            "stateStr" : "ARBITER",
            "uptime" : 329104,
            "lastHeartbeat" : ISODate("2015-04-27T12:20:38Z"),
            "lastHeartbeatRecv" : ISODate("2015-04-27T12:20:37Z"),
            "pingMs" : 0
        },
        {
            "_id" : 6,
            "name" : "yyyyyyy:27017",
            "health" : 1,
            "state" : 1,
            "stateStr" : "PRIMARY",
            "uptime" : 579120,
            "optime" : Timestamp(1430137238, 300),
            "optimeDate" : ISODate("2015-04-27T12:20:38Z"),
            "electionTime" : Timestamp(1429808169, 7),
            "electionDate" : ISODate("2015-04-23T16:56:09Z"),
            "self" : true
        }
    ],
    "ok" : 1
}
  • Please provide the hardware setup of both the primary and the secondary. – Markus W Mahlberg Apr 28 '15 at 9:35
  • What is reported by db.version() and version() in the mongo shell? Have you recently upgraded your version of MongoDB or is this a fresh install? – Stennie Apr 28 '15 at 14:35
0

I don't know that I see a problem. It says right in the second line shown that the source data is "source: xxxxxx:27017" and if you look further down, in the status results, that server is actually the secondary. So the way I read this (and let me know if I am wrong) you are submitting the command on the Primary, but it is actually querying the secondary and saying it is over 7 hours behind the Primary. Then you do a status and it shows the replicaSet with an optTimeDate of the same time difference.

If I were to make a guess, (and this is only a guess) I would say that one of the two machines is time-sync'd via ntp but the other is not (and the arbitrator appears to match the primary, so it is more likely the one that is time-sync'd meaning your secondary is running slow).

0

From the MongoDB Documentation (emphasis mine) for rs.printSlaveReplicationInfo:

Returns a formatted report of the status of a replica set from the perspective of the secondary member of the set. The output is identical to that of db.printSlaveReplicationInfo().

So it is indicating your secondary is 7 hours behind your primary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.