Running mongodb on win2012
Mongo db version v2.6.4
Our collection is created with this param:
capped:true, size:500000000000 // 500 gb
But the data dir, that only holds this one collection, has grown to 720gb.
There is no replication in use at all on this mongo server.
What can I do to keep the data dir at ~ 500 gb?
This db does get massive amounts of inserts at times, but we also need to control the max size (and let it discard old data).
Is it possible that the capped size does not include indexes?
Or is there other overhead I should account for? (and how?
Or?
db stats
> db.stats
function (scale){
return this.runCommand( { dbstats : 1 , scale : scale } );
}
> db.stats()
{
"db" : "logging",
"collections" : 3,
"objects" : 289637086,
"avgObjSize" : 2076.3166847770317,
"dataSize" : 601378314192,
"storageSize" : 606012620432,
"numExtents" : 305,
"indexes" : 12,
"indexSize" : 147827443456,
"fileSize" : 776943435776,
"nsSizeMB" : 16,
"dataFileVersion" : {
"major" : 4,
"minor" : 5
},
"extentFreeList" : {
"num" : 0,
"totalSize" : 0
},
"ok" : 1
}
>
The command we use to create the collection:
db.createCollection("LogItem", { capped:true, size:500000000000 })
So the collection we write to is created with the capped cmd. and that is where all the space is
I can't do db.collection.stats() because out of disk space…
Thank you!
Best Answer
OK, we solved this.
Issue is that mongo auto creates the collection when incoming data comes in.
So the problem was:
But #3 comes too late, as the collection is already present, as not capped, because of #2.
Solution:
Now I have a capped collection!