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.

I have one case where i create db for Daily data. I have some collections in this db which are sharded. My requirement is as follows: Create every day DB If There is a DB which is more than 7 days old take its dump in some location and delete it from live DB.

I have one question how can i check if chunk transfer/balancing was completed for this DB before taking its dump and deleting it. I am concern if i delete the DB whose chinks were not transferred completed will it corrupt my system

Regards Virendra Agarwal

share|improve this question

1 Answer 1

up vote 1 down vote accepted

To ensure there are no migrations in progress while taking your backup, you should stop the balancer via sh.stopBalancer(). Any in-progress migrations will be completed before the balancer is disabled.

If you want to ensure the balancer is stopped before taking your backup, you can run the following in the mongo shell, which should return true:

 !sh.getBalancerState() && !sh.isBalancerRunning()

After taking your backup, you need to remember to start the balancer again.

share|improve this answer
    
Thats a great answer –  viren Aug 25 at 9:33

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.