Restoring a Single Node Backup to an On-Premises Database
This section uses the Linux operating system as an example to describe how to restore the downloaded backup file of a single node instance to your on-premises database. For details about how to download backup files, see Downloading Backup Files.
Huawei Cloud has discontinued the sale of DDS single node instances since July 15, 2023.
Precautions
- MongoDB client 3.4 has been installed on your on-premises MongoDB database.
- Only DDS 3.4 and 4.0 instances can be restored in this method. DDS 4.2 does not support this method.
- For details about how to migrate data at the database or collection level, see Migrating Data Using mongodump and mongorestore.
Procedure
- Download the backup file of the single node.
- Log in to the device that can access the on-premises database.
- Upload the single-node backup file to the device that can access the on-premises database.
Select an uploading method based on the OS you are using. In Linux, for example, run the following command:
scp -r <IDENTITY_DIR> <REMOTE_USER>@<REMOTE_ADDRESS>:<REMOTE_DIR>
- IDENTITY_DIR is the directory that stores the backup file.
- REMOTE_USER is the username for logging in to the device that can access the on-premises database.
- REMOTE_ADDRESS is the IP address of the host that can access the on-premises database.
- REMOTE_DIR is the destination directory to which the backup file is imported.
In Windows, upload the backup file using file transfer tools.
- Import the backup files in the on-premises database.
./mongorestore --host <DB_HOST> --port <DB_PORT> -u <DB_USER> --authenticationDatabase <AUTH_DB> --drop --gzip --archive=<Backup directory> -vvvv --stopOnError
- DB_HOST is the on-premises database address.
- DB_PORT is the on-premises database port.
- DB_USER is the on-premises database username.
- AUTH_DB is the database that authenticates DB_USER. Generally, this value is admin.
- Backup directory is the backup file name.
Enter the password for logging in to the on-premises database when prompted:
Enter password:
Example:
./mongorestore --host 192.168.6.187 --port 8635 -u rwuser --authenticationDatabase admin --drop --gzip --archive=xxx_tar.gz -vvvv --stopOnError
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot