Mongodb副本具有不同的数据

时间:2015-07-02 13:25:59

标签: mongodb

我已将mongodb从2.4升级到2.6(升级3.0的第一步)。一切看起来都很好但是当我检查一些集合并得到count()时,我会遇到不同的值。以下是关于我的mongodb复制品的一些信息。

rs.status()

{
"set" : "MongoCls",
"date" : ISODate("2015-07-02T13:11:31Z"),
"myState" : 1,
"members" : [
    {
        "_id" : 0,
        "name" : "mongo-db1.mydomain.com:myport",
        "health" : 1,
        "state" : 2,
        "stateStr" : "SECONDARY",
        "uptime" : 18430,
        "optime" : Timestamp(1435842673, 3),
        "optimeDate" : ISODate("2015-07-02T13:11:13Z"),
        "lastHeartbeat" : ISODate("2015-07-02T13:11:30Z"),
        "lastHeartbeatRecv" : ISODate("2015-07-02T13:11:30Z"),
        "pingMs" : 0,
        "syncingTo" : "mongo-db2.mydomain.com:27017"
    },
    {
        "_id" : 1,
        "name" : "mongo-db2.mydomain.com:myport",
        "health" : 1,
        "state" : 1,
        "stateStr" : "PRIMARY",
        "uptime" : 18431,
        "optime" : Timestamp(1435842673, 3),
        "optimeDate" : ISODate("2015-07-02T13:11:13Z"),
        "electionTime" : Timestamp(1435824275, 1),
        "electionDate" : ISODate("2015-07-02T08:04:35Z"),
        "self" : true
    },
    {
        "_id" : 2,
        "name" : "mongo-db3.mydomain.com:myport",
        "health" : 1,
        "state" : 2,
        "stateStr" : "SECONDARY",
        "uptime" : 18430,
        "optime" : Timestamp(1435842673, 3),
        "optimeDate" : ISODate("2015-07-02T13:11:13Z"),
        "lastHeartbeat" : ISODate("2015-07-02T13:11:31Z"),
        "lastHeartbeatRecv" : ISODate("2015-07-02T13:11:29Z"),
        "pingMs" : 0,
        "syncingTo" : "mongo-db2.mydomain.com:myport"
    },
    {
        "_id" : 3,
        "name" : "mongo-db-arbiter.mydomain.com:myport",
        "health" : 1,
        "state" : 7,
        "stateStr" : "ARBITER",
        "uptime" : 18430,
        "lastHeartbeat" : ISODate("2015-07-02T13:11:30Z"),
        "lastHeartbeatRecv" : ISODate("2015-07-02T13:11:31Z"),
        "pingMs" : 0
    }
],
"ok" : 1

}

在主副本中,rs.printReplicationInfo()

configured oplog size:   5120MB
log length start to end: 14131222secs (3925.34hrs)
oplog first event time:  Tue Jan 20 2015 01:55:51 GMT+XXXX (XXX)
oplog last event time:   Thu Jul 02 2015 16:16:13 GMT+XXX (XXX)
now:                     Thu Jul 02 2015 16:16:54 GMT+XXX (XXX)

在其中一个辅助副本rs.printSlaveReplicationInfo()

source: mongo-db1.mydomian.com:myport
    syncedTo: Thu Jul 02 2015 16:17:13 GMT+XXX (XXX)
    0 secs (0 hrs) behind the primary 
source: mongo-db3.mydomain.com:myport
    syncedTo: Thu Jul 02 2015 16:17:13 GMT+XXX (XXX)
    0 secs (0 hrs) behind the primary 

在另一个辅助副本中,rs.printSlaveReplicationInfo()

source: mongo-db1.mydomain.com:myport
    syncedTo: Thu Jul 02 2015 16:19:13 GMT+XXX (XXX)
    0 secs (0 hrs) behind the primary 
source: mongo-db3.mydomain.com:myport
    syncedTo: Thu Jul 02 2015 16:19:13 GMT+XXX (XXX)
    0 secs (0 hrs) behind the primary 

一切看起来都不错但是当我试着依靠一个系列时,我会得到不同的结果。辅助副本具有相同的结果,但主副本具有不同的结果。

这可能是什么原因造成的?有没有办法强制同步副本除了初始同步?您有什么建议或想法可以解决这个问题吗?

编辑:我正在检查的集合不是活动集合。我的意思是暂时没有插入,删除或更新。

0 个答案:

没有答案