【发布时间】:2019-01-10 21:07:29
【问题描述】:
我在 ARM 处理器上使用 MongoDB 2.4 32 位。我正在我的数据库中创建动态集合。我浏览了 MongoDB 文档,其中指出 - 存储引擎 MMAP 为文件系统预先分配高达 2GB 的磁盘空间。 32-bit MongoDB processes are limited to about 2 gb of data
这是 db.stats() 的输出
{
"db" : "admin",
"collections" : NumberInt(40),
"objects" : NumberInt(998),
"avgObjSize" : 196.9498997995992,
"dataSize" : NumberInt(196556), #~1MB
"storageSize" : 1478905856.0,
"numExtents" : NumberInt(42),
"indexes" : NumberInt(50),
"indexSize" : NumberInt(433328),
"fileSize" : 2197028864.0, #2GB
"nsSizeMB" : NumberInt(16),
"dataFileVersion" : {
"major" : NumberInt(4),
"minor" : NumberInt(5)
},
"ok" : 1.0
}
在这里您可以看到数据大小为 1MB,但文件大小为 ~=2GB。达到 2GB 文件大小限制后,它不允许我创建新集合。
du -sh /data/db
2.1G /data/db/
当我尝试使用 --repairpath 选项修复数据库时,它仍然给出错误
mongod --repair --repairpath /data/db2
错误
[initandlisten] ERROR: mmap() failed for /data/db/admin.7 len:536608768 errno:12 Cannot allocate memory
[initandlisten] ERROR: mmap failed with out of memory. You are using a 32-bit build and probably need to upgrade to 64
[initandlisten] ERROR: mmap() failed for /data/db2/_tmp_repairDatabase_0/admin.2 len:134217728 errno:12 Cannot allocate memory
[initandlisten] ERROR: mmap failed with out of memory. You are using a 32-bit build and probably need to upgrade to 64
[initandlisten] exception in initAndListen: 10084 can't map file memory - mongo requires 64 bit build for larger datasets, terminating
dbexit:
关于如何解决此问题的任何建议,
【问题讨论】:
-
您使用的是小文件选项吗? (docs.mongodb.com/v2.4/reference/configuration-options/…)?
-
没有。我没有指定任何 smallfiles 选项,所以我猜默认应该是 false。