Compact/repair collections individually

1,129 views
Skip to first unread message

Santosh c

unread,
Oct 6, 2011, 9:50:40 PM10/6/11
to mongodb-user
My disk is 60% full, so I couldnt complete the repairDatabase command.  Is there a way I can repair each collection separately? It's a production system so what other option do I have? I want to basically check if repair compacts any space.
 
thanks.

Scott Hernandez

unread,
Oct 6, 2011, 9:58:26 PM10/6/11
to mongod...@googlegroups.com
If you have more than one database you can repair each db without
doing them all, but no, it is not by collection. The files are for
databases, not collections. To reclaim disk space on the filesystem
you need to repair a database, for now.

> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to
> mongodb-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mongodb-user?hl=en.
>

Santosh c

unread,
Oct 6, 2011, 10:04:49 PM10/6/11
to mongod...@googlegroups.com
I just noticed mongodump takes both "-c collection_name" and "--repair", can I use this to dump one collection that is repaired and reimport it again using mongorestore? will it work?

Santosh c

unread,
Oct 6, 2011, 10:09:28 PM10/6/11
to mongod...@googlegroups.com
It doesnt seem to work without --dbpath.  So I have no option now but to add additional diskspace?

Scott Hernandez

unread,
Oct 6, 2011, 10:11:55 PM10/6/11
to mongod...@googlegroups.com
The repair option only works for a single database and when the server
is stopped (by specifying the dbpath).

If this is part of a replica set then you should remove the data and
start from a copy of the good replica.

Santosh c

unread,
Oct 8, 2011, 6:58:49 AM10/8/11
to mongod...@googlegroups.com
Hi,
I am using 1.8.1, doesnt it have "compact" command? I am trying to compact a collection, I deleted documents in it and now I want to free up the disk space. Is it present in 1.8.3 latest if I upgrade?
 
thanks

Karl Seguin

unread,
Oct 8, 2011, 7:11:31 AM10/8/11
to mongod...@googlegroups.com
No, it's only part of 2.0.0
Reply all
Reply to author
Forward
0 new messages