0

First off let me say I am a newB when it comes to Mongo, so excuse my ignorance. With that being said:

Using db.copyDatabase() to copy a remote database:

What impact does this have on the database being copied. Please note the the database being copied is currently being use by a live application.

Would db.copyDatabase() lock the database?

What about performance, would it make the database run slower?

I don't really mind if while coping some new data is being written to the DB. The copy does not have to be exact per say, it just need to be as close as possible to the live DB. But I am really concern about performance issue, is it safe to do this on a live DB?

1
  • I answered your question on MongoDB-user Google group which is probably a more appropriate place for the question anyway. Dec 5, 2014 at 0:21

1 Answer 1

1

The docs for MongoDB discuss the behavior of copyDatabase in detail: http://docs.mongodb.org/manual/reference/method/db.copyDatabase/#behavior

Specifically, copyDatabase reads the data from the source DB the same way something like a backup or full collection query would read it - that means that it may impact the performance of that DB (for example, by bringing more data into RAM which may displace some other data) but the impact would be about the same as running mongodump on that DB.

The docs do explicitly mention that the copied database does not get locked.

If you are running a replica set, you can copyDatabase from a secondary node

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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