MongoDB克隆(db.copyDatabase),克隆只有一半的数据库

时间:2013-05-04 13:40:47

标签: mongodb

我有大约4 GB数据的数据库,当我尝试通过mongodump转储它时,它只转储大约1,93 GB的数据。当我尝试通过db.copyDatabase()克隆它时,它会复制与mongodump相同数量的数据。

MongoDb有一些限制吗?

感谢您的帮助,抱歉我的英语不好(我希望您能理解我)。

修改

{
        "ns" : "some-db.persons",
        "firstExtent" : "0:31000 ns:some-db.persons",
        "lastExtent" : "4:b50d000 ns:some-db.persons",
        "extentCount" : 13,
        "extents" : [
                {
                        "loc" : "0:31000",
                        "xnext" : "0:42000",
                        "xprev" : "null",
                        "nsdiag" : "some-db.persons",
                        "size" : 32768,
                        "firstRecord" : "0:310b0",
                        "lastRecord" : "0:38e3c"
                },
                {
                        "loc" : "0:42000",
                        "xnext" : "0:62000",
                        "xprev" : "0:31000",
                        "nsdiag" : "some-db.persons",
                        "size" : 131072,
                        "firstRecord" : "0:420b0",
                        "lastRecord" : "0:61e64"
                },
                {
                        "loc" : "0:62000",
                        "xnext" : "0:e2000",
                        "xprev" : "0:42000",
                        "nsdiag" : "some-db.persons",
                        "size" : 524288,
                        "firstRecord" : "0:620b0",
                        "lastRecord" : "0:e0f0c"
                },
                {
                        "loc" : "0:e2000",
                        "xnext" : "0:372000",
                        "xprev" : "0:62000",
                        "nsdiag" : "some-db.persons",
                        "size" : 2097152,
                        "firstRecord" : "0:e20b0",
                        "lastRecord" : "0:2e1d94"
                },
                {
                        "loc" : "0:372000",
                        "xnext" : "0:dd6000",
                        "xprev" : "0:e2000",
                        "nsdiag" : "some-db.persons",
                        "size" : 8388608,
                        "firstRecord" : "0:3720b0",
                        "lastRecord" : "0:b71e80"
                },
                {
                        "loc" : "0:dd6000",
                        "xnext" : "0:2233000",
                        "xprev" : "0:372000",
                        "nsdiag" : "some-db.persons",
                        "size" : 11325440,
                        "firstRecord" : "0:dd60b0",
                        "lastRecord" : "0:18a2db8"
                },
                {
                        "loc" : "0:2233000",
                        "xnext" : "1:2000",
                        "xprev" : "0:dd6000",
                        "nsdiag" : "some-db.persons",
                        "size" : 15290368,
                        "firstRecord" : "0:22330b0",
                        "lastRecord" : "0:30c7e20"
                },
                {
                        "loc" : "1:2000",
                        "xnext" : "1:223d000",
                        "xprev" : "0:2233000",
                        "nsdiag" : "some-db.persons",
                        "size" : 20643840,
                        "firstRecord" : "1:20b0",
                        "lastRecord" : "1:13b1e9c"
                },
                {
                        "loc" : "1:223d000",
                        "xnext" : "2:2000",
                        "xprev" : "1:2000",
                        "nsdiag" : "some-db.persons",
                        "size" : 27869184,
                        "firstRecord" : "1:223d0b0",
                        "lastRecord" : "1:3cd0e7c"
                },
                {
                        "loc" : "2:2000",
                        "xnext" : "2:73ba000",
                        "xprev" : "1:223d000",
                        "nsdiag" : "some-db.persons",
                        "size" : 37625856,
                        "firstRecord" : "2:20b0",
                        "lastRecord" : "2:23e3dd8"
                },
                {
                        "loc" : "2:73ba000",
                        "xnext" : "3:4bd7000",
                        "xprev" : "2:2000",
                        "nsdiag" : "some-db.persons",
                        "size" : 50798592,
                        "firstRecord" : "2:73ba0b0",
                        "lastRecord" : "2:a42be78"
                },
                {
                        "loc" : "3:4bd7000",
                        "xnext" : "4:b50d000",
                        "xprev" : "2:73ba000",
                        "nsdiag" : "some-db.persons",
                        "size" : 68579328,
                        "firstRecord" : "3:4bd70b0",
                        "lastRecord" : "3:8d3dda4"
                },
                {
                        "loc" : "4:b50d000",
                        "xnext" : "null",
                        "xprev" : "3:4bd7000",
                        "nsdiag" : "some-db.persons",
                        "size" : 92581888,
                        "firstRecord" : "4:b50d0b0",
                        "lastRecord" : "4:ba17118"
                }
        ],
        "datasize" : 244286608,
        "nrecords" : 268872,
        "lastExtentSize" : 92581888,
        "padding" : 1,
        "firstExtentDetails" : {
                "loc" : "0:31000",
                "xnext" : "0:42000",
                "xprev" : "null",
                "nsdiag" : "some-db.persons",
                "size" : 32768,
                "firstRecord" : "0:310b0",
                "lastRecord" : "0:38e3c"
        },
        "lastExtentDetails" : {
                "loc" : "4:b50d000",
                "xnext" : "null",
                "xprev" : "3:4bd7000",
                "nsdiag" : "some-db.persons",
                "size" : 92581888,
                "firstRecord" : "4:b50d0b0",
                "lastRecord" : "4:ba17118"
        },
        "objectsFound" : 218678,
        "invalidObjects" : 0,
        "bytesWithHeaders" : 207046812,
        "bytesWithoutHeaders" : 203547964,
        "deletedCount" : 6,
        "deletedSize" : 87297536,
        "nIndexes" : 1,
        "keysPerIndex" : {
                "some-db.persons.$_id_" : 268872
        },
        "valid" : true,
        "errors" : [ ],
        "ok" : 1
}

1 个答案:

答案 0 :(得分:0)

数据很可能都存在; MongoDB会随着时间的推移分配额外的空间,而这些空间不会包含在副本中。检查集合中的doc计数以进行验证。