MongoDB – Is it Safe to Transfer Database with rsync While Working?

mongodbmongodb-3.2mongodb-3.4

I need to transfer MongoDB data from another server with rsync with MongoDB running. Making a dump is not an option for me, as it takes too much time.

What problems can I face doing it? Or, if this is not an option, how can I transfer data (var/lib/mongdobd) from one MongoDB instance to another without stopping it?

I use MongoDB version 3.2.11 in production (one instance,no replicas) and I need to transfer data from MongoDB version 3.4.9

Best Answer

No, not directly! If your data is top of LVM, do a snapshot and copy that to another node, start it and connect it to the replica set. This only if you have lot's of data and normal initial sync (as @SqlWorldWide wrote) would take too long time.