1

Is it possible to dump the database (the only one of many on the host) while the database and related services are running? At this time, data will continue to be written to the database. It is necessary to transfer the database to another host without using replication (different versions of the database) and at the same time reduce the downtime of services. This scenario is assumed:

  1. Start backing up data from the working database.
  2. Wait until most of the backup is complete.
  3. Disable services and write data to the database (downtime).
  4. Finish data backup (downtime). It is assumed that we have a complete data dump here.
  5. Recover data on a new host (downtime).
  • Do you have a replica set? The shortest way of getting a backup would be `db.fsyncLock()` -> file system snapshot -> `db.fsyncUnlock()`, see https://docs.mongodb.com/manual/tutorial/backup-with-filesystem-snapshots/ The application will sleep (still providing read/only operations) for maybe one second. – Wernfried Domscheit Dec 15 '21 at 10:59
  • @WernfriedDomscheit No. The goal is to create a replica set, but only for one database. The current database host contains too many databases and the data is taking up too much space. I also haven't found a way to set up replication of a single DB. According to the documentation, replication is only possible for the entire node. – Pavel Shabalin Dec 15 '21 at 11:05
  • Then maybe create an empty replica set and copy all data afterwards, see https://stackoverflow.com/questions/11554762/how-to-copy-a-collection-from-one-database-to-another-in-mongodb/67077465#67077465 – Wernfried Domscheit Dec 15 '21 at 11:14
  • Why are not going to put all databases to a replica set? Then your application would be down only while single DB restart, see https://docs.mongodb.com/manual/tutorial/convert-standalone-to-replica-set/ – Wernfried Domscheit Dec 15 '21 at 11:18
  • Even by creating a new replica set, it is possible to replicate only the entire node completely with all the databases (here I do not mean the collection). The node contains too much data for any host on the internal network to be able to complete a replica. – Pavel Shabalin Dec 15 '21 at 11:50
  • Not clear what you mean by "replicate only the entire node completely with all the databases" - sounds contradiction by itself. – Wernfried Domscheit Dec 15 '21 at 14:22

0 Answers0