我的数据库非常小:
> db.stats();
{
"db" : "oyun",
"collections" : 29,
"objects" : 2557,
"avgObjSize" : 355.83418068048496,
"dataSize" : 909868,
"storageSize" : 2410483712,
"numExtents" : 64,
"indexes" : 44,
"indexSize" : 605024,
"fileSize" : 4226809856,
"nsSizeMB" : 16,
"ok" : 1
}
我的总数据库大小是字节,但我的system.indexes kb!总文件空间消耗巨大!此数据库仅保留1 MB数据附近。
> db.system.indexes.stats();
{
"ns" : "oyun.system.indexes",
"count" : 44,
"size" : 3924,
"avgObjSize" : 89.18181818181819,
"storageSize" : 2408275968,
"numExtents" : 20,
"nindexes" : 0,
"lastExtentSize" : 630562816,
"paddingFactor" : 1,
"systemFlags" : 0,
"userFlags" : 0,
"totalIndexSize" : 0,
"indexSizes" : {
},
"ok" : 1
}
[root@guybrush /]# find . -type f -size +200000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
./data/journal/prealloc.2: 1.0G
./data/journal/j._13: 1.0G
./data/journal/j._12: 1.0G
./data/mongodb/main/oyun.3: 512M
./data/mongodb/main/oyun.2: 256M
./data/mongodb/main/oyun.5: 2.0G
./data/mongodb/main/oyun.4: 1.0G
我如何缩小数据库?我试过repairDatabase命令。