Reputation: 63
Appreciate any insights on this, I have 2 questions:
1) Figure out why my local db oplog is massive and growing
2) Safely delete (or reset) my local.oplog to free up the 18 gbs of wasted space
The scenario: I have been running mongod locally on a snapshot of production data like this:
mongod --dbpath /temp/MongoDumps/mongodata-2013-06-05_1205-snap/data
So I noticed the weird thing is my local db is huge
> show dbs
local 18.0693359375GB
prod-snapshot 7.9501953125GB
Which appears to be due to the gigantic local db oplog (even though its a capped collection)
db.oplog.rs.stats()
{
"ns" : "local.oplog.rs",
"count" : 25319382,
"size" : 10440151664,
"avgObjSize" : 412.33832895289464,
"storageSize" : 18634489728,
"numExtents" : 9,
"nindexes" : 0,
"lastExtentSize" : 1463074816,
"paddingFactor" : 1,
"systemFlags" : 0,
"userFlags" : 0,
"totalIndexSize" : 0,
"indexSizes" : {
},
"capped" : true,
"max" : NumberLong("9223372036854775807"),
"ok" : 1
}
And despite not having setup any replica sets on my local, my local db seems to have inherited my production replica set configurations (maybe it's inheriting through the snapshot???)
rs.config()
{
"_id" : "mongocluster1",
"version" : 38042,
"members" : [
{
"_id" : 4,
"host" : "mongolive-01D.mcluster-01:27017",
"tags" : {
"app" : "backend"
}
},
{
"_id" : 5,
"host" : "mongolive-01C.mcluster-01:27017"
},
{
"_id" : 11,
"host" : "mongoarbiter-01C.mcluster-01:27017",
"arbiterOnly" : true
},
{
"_id" : 7,
"host" : "mongoremote-01Z.mcluster-01:27017",
"priority" : 0,
"hidden" : true
},
{
"_id" : 21,
"host" : "mongodelayed-01D.mcluster-01:27017",
"priority" : 0,
"slaveDelay" : 3600,
"hidden" : true
}
]
}
Not sure if related but also seeing this:
> rs.status()
{ "ok" : 0, "errmsg" : "not running with --replSet" }
And when I start the server I get a replicaSet warning:
MongoDB shell version: 2.4.1
connecting to: test
Server has startup warnings:
** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
** WARNING: mongod started without --replSet yet 1 documents are present in local.system.replset
** Restart with --replSet unless you are doing maintenance and no other clients are connected.
** The TTL collection monitor will not start because of this.
Upvotes: 4
Views: 5050
Reputation: 42362
You captured a snapshot of the data directory of a production node and therefore you got its EXACT database configuration.
This include its "local" database. The local database includes (among other things) the replica set configuration and the oplog.
Since you intend to run your mongod
in stand-alone mode you can simply drop the local
database with no ill effect. Use the dropDatabase() command. This will drop the database and the space will be reclaimed by the OS.
Upvotes: 3