Mongodb – mongo primary is showing behind the primary

mongodb

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
}

Best Answer

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).