le0pard/mongodb_logger

Is there a trick to getting the capsize to increase on a deployed load

Closed this issue · 2 comments

I have my capsize set to 100mb on production, and I tried to deploy a new version with 500mb, but it does not seem to take (the webpage front end still says 100mb). Do you need to delete and recreate your mongo database or something to get a larger capacity?

You basically need to create a new capped collection and copy the docs to it. This can be done very easily in the javascript (shell):

$ mongo
MongoDB shell version: 2.0.4
connecting to: test
> show dbs
local   2.2021484375GB
monkey_logs_dev 0.453125GB
> use monkey_logs_dev
switched to db monkey_logs_dev
> db.createCollection("new", {capped:true, size:524288000}); /* size in bytes */
{ "ok" : 1 } 
> db.old.find().forEach(function (d) {db.new.insert(d)});
> db.old.renameCollection("bak", true);
> db.new.renameCollection("old", true);

"old" - current name of collection, "new" - temporary name of new collection with new capsize.

Note: Just make sure nobody is inserting/updating the old collection when you switch. If you run that code in a db.eval("....") it will lock the server while it runs.

Also you can just create new collection and switch to it, but your old logs will be in old collection.

Thanks!