Mongo db backup configuration

I have create backups with mongodump utility. Having 2 servers in replica set configuration.
Mongo backups are in directory /var/backups/18May2021 . And I want to restore it on another server which is standalone . mongo server with backup configuration ip is for example and the server which is standalone and wanting to restore backup here is How can I do it, inside the backup folder /var/backups/18May2021 there are two folders admin and products.

Hi Nanuka_Zedginidze,

If you are taking a backup with mongodump then you will use the mongorestore tool to restore the data. You just add the standalone host as the “host” in the restore string. It would look something like this

mongorestore --host --port <port number> -u <admin user> --authenticationDatabase <auth db> /var/backups/18May2021

The admin and products directory are the databases in your MongoDB so they will both be restored.

1 Like

Thank u ,
so in case of not using auth it will be:

mongorestore --host --port 27017 /var/backups/18May2021.

Yes, if there is no authentication on your Mongo cluster you would not provide a username or authentication DB

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.