MongoDB 2.4 32 not create collection after filesize 2gb but data size 1 MB
I finally found the root cause of this problem where fileSize is ~=2GB and dataSize is few MBs and its solution.
Root cause - If the database uses a capped collection, MongoDB 2.4 MMAP storage engine allocates a fixed amount of disk space for this capped collection. Any attempt to create new collections after the datafile size is reached will cause MongoDB 2.4 to throws error.
cant map file memory-mongo requires 64 bit build for larger datasets
In my case, I was creating capped collections dynamically.
Solution - Any operations using the
So use
mongod
command to repair database will fail as it requires additional memory to perform these operations.So use
mongodump
to get the database dump along with --repair
which will create a dump without "capped" limit for all capped collections and then mongorestore
itmongodump --username <username> --password <password> --dbpath <path> --db <db> --out <path> --repair
Step 2 - Drop database
db.dropDatabase()
Step 3 - Restore the dump
mongorestore --username <username> --password <password> --dbpath <path> --db <db> <path>
db.runCommand({" convertToCapped": "mycoll", size: 100000});
Hope this helps.
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
}
No comments:
Post a Comment