为什么碎片需要大量存储?

时间:2013-05-26 09:19:20

标签: linux mongodb sharding

我正在测试mongodb的分片功能,我将30278845文件插入到一个集合中,现在的磁盘状态是

# ls
configDb  shard1-1  shard2-1
# du -csh shard1-1/
87G     shard1-1/
# du -csh shard2-1/
90G     shard2-1/

这是收藏文件,我不明白为什么会占用这么多空间?

mongos> db.testtable.find()
{ "_id" : ObjectId("51a1ce8a4c8b466d008b6780"), "name" : "6BScn0", "age" : 13 }
{ "_id" : ObjectId("51a1b9920c30fb7000000000"), "name" : "HXnAZv", "age" : 13 }
{ "_id" : ObjectId("51a1ce8a4c8b466d008b6910"), "name" : "kRZXj3", "age" : 13 }
{ "_id" : ObjectId("51a1b9920c30fb7000000001"), "name" : "3K4lev", "age" : 13 }
{ "_id" : ObjectId("51a1ce8a4c8b466d008b6974"), "name" : "A0D2wo", "age" : 13 }
{ "_id" : ObjectId("51a1b9920c30fb7000000002"), "name" : "AmhkRV", "age" : 13 }
{ "_id" : ObjectId("51a1ce8a4c8b466d008b6a3c"), "name" : "17mVkj", "age" : 13 }
{ "_id" : ObjectId("51a1b9920c30fb7000000003"), "name" : "E8t6Jf", "age" : 13 }
{ "_id" : ObjectId("51a1ce8a4c8b466d008b6b68"), "name" : "0u8vhV", "age" : 13 }
{ "_id" : ObjectId("51a1b9920c30fb7000000004"), "name" : "ZNCzlL", "age" : 13 }
{ "_id" : ObjectId("51a1ce8a4c8b466d008b6cf8"), "name" : "DmCJRp", "age" : 13 }
{ "_id" : ObjectId("51a1b9920c30fb7000000005"), "name" : "s3JPDJ", "age" : 13 }
{ "_id" : ObjectId("51a1ce8a4c8b466d008b6fb4"), "name" : "C9GE0B", "age" : 13 }
{ "_id" : ObjectId("51a1b9920c30fb7000000006"), "name" : "kHtp3I", "age" : 13 }
{ "_id" : ObjectId("51a1ce8a4c8b466d008b7018"), "name" : "nrcUYc", "age" : 13 }
{ "_id" : ObjectId("51a1b9920c30fb7000000007"), "name" : "VD4cYW", "age" : 13 }
{ "_id" : ObjectId("51a1ce8a4c8b466d008b720c"), "name" : "bK6HdH", "age" : 13 }
{ "_id" : ObjectId("51a1b9920c30fb7000000008"), "name" : "7C5AJO", "age" : 13 }
{ "_id" : ObjectId("51a1ce8a4c8b466d008b75f4"), "name" : "5ZdZDj", "age" : 13 }
{ "_id" : ObjectId("51a1b9920c30fb7000000009"), "name" : "QIBshX", "age" : 13 }
Type "it" for more

1 个答案:

答案 0 :(得分:0)

我重新阅读了有关mongodb存储的文档,并将其弄清楚,doc说

默认的alloation大约是64位安装上磁盘空间的5%。

我的磁盘状态为

/dev/sda7             1.8T  176G  1.5T  11% /

我在磁盘上有两个碎片,总计是90 * 2G,这是原因:)