0

I have a sharded MongoDB cluster running 3 different Databases. Currently all 3 databases has the same shard configured as their primary shard (shard000) Is it possible to change the primary shard for one of these databases to something other than shard000?

Just to make things clear, I have no intention of retiring shard000 any time soon, I just want to remove some of the non shared collections load off it.

Thanks, Meny

2

Yes you can with a single command:

db.adminCommand({ movePrimary : "YourDBName", to : "shard001" })

then is important to flush configuration on all mongos (suppose all than the one that did the move, but better be safe):

db.adminCommand({flushRouterConfig: 1})

If your databases are small you can do it on-the-fly, else you better plan for a downtime only for this database during the move process.

Useful link: http://docs.mongodb.org/manual/reference/command/movePrimary/

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.