Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

To take advantage of the improved concurrency in Mongodb 2.2--namely database level locking--we would like to move a sharded collection to a new database.

I have been unable to find any documentation which will help with this particular scenario.

I know I cant just "rename" this sharded collection: https://groups.google.com/d/topic/mongodb-user/lajAcp3HkZ4/discussion

The only thing I can think of is mongodump the entire collection and mongorestore into a new database. What are my other options?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

A mongodump and mongorestore (or a similar script to accomplish the same thing) to backup and re-import the data is the most straight forward way of doing this at the moment until SERVER-6063 is implemented.

The only other option I can think of would be to move all chunks to a single shard, wipe out the sharding config for the collection (effectively unsharding it) and then do the rename on that shard. Once that was complete, you could re-shard the collection.

This would be:

  1. Dangerous (messing with the config meta data is always a bad idea)
  2. Unsupported (if you get into trouble, it's probably up to you to fix it)
  3. More complicated (since the first recommended thing to do would be to backup your data via mongodump)

As one other alternative - can you move everything else (perhaps unsharded) out of this database? Obviously this would not be helpful if you have other large sharded collections in this DB, but just wanted to make sure it was considered.

share|improve this answer
1  
it does seem like mongodump and mongorestore are my only options, I was hoping I wasn't thinking of something. Unfortunately there are other large, sharded collections in this database. Your response is much appreciated. –  Chris W. Oct 8 '12 at 17:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.