0

We have Sharded Mongo Cluster. However some documents are sharded and others are unsharded.

We are planning to migrate these databases to new cluster. Please update if there is any process or steps to migrate the data from one sharded cluster to the other.

We have two secondaries and 1 primary for each shard,MongoS,3 Config Servers,2 Arbitors. I understood that copydb can not be used on the sharded collection. Please suggest if there is any other way.

3

Migrating an existing sharded cluster to new hardware

If you want to migrate a sharded cluster to new hardware, there is a tutorial in the MongoDB manual: Migrate a Sharded Cluster to Different Hardware

Migrating data in an existing sharded cluster to a new cluster

There is no officially supported process to migrate documents between two different MongoDB clusters (at least as at MongoDB 2.6), but you do have a few options:

  • A typical approach is via backup & restore of the sharded cluster, but that involves some down time or a custom script to sync up changes that occurred while you were loading data into the new cluster.

  • The team at Mailbox has open sourced a set of Python scripts called Hydra which specifically aim to enable live migration of sharded collections. For more background details see: Scaling MongoDB at Mailbox.

I haven't personally tried Hydra (and there is currently a caveat in the Github repo that the authors only tested with MongoDB 2.2.3 on Ubuntu 12.04), however it seems like a promising approach.

  • Thank you, you are a life saver!!! I can attest that Hydra works for copying from MongoDB v2.4.14 to TokuMX 2.0.1-1 (version in shell: v2.0.1-mongodb-2.4.10). I had to modify sources to skip copying indexes though. It doesn't seem to work from TokuMX to MongoDB. – johndodo Aug 25 '15 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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