In this post let's see how we can backup and restore databases in an Azure Cosmos DB for MongoDB account using MongoDB Command Line Database Tools.
I am using Windows and the first step is to download MongoDB Command Line Database Tools. As of today, the version is 100.6.1 and I have downloaded the zip version. You can even download the msi and install the tools.
Backup
You can run the mongodump.exe from the command prompt providing the connection string of your Azure Cosmos DB for MongoDB account, the database you want to backup and an output path to write the backup files to.
mongodump.exe --uri "<connectionString>" --db <databaseName> --out <backupDirectory>
mongodump.exe |
Restore
You can run the mongorestore.exe from the command prompt providing the connection string of your Azure Cosmos DB for MongoDB account, a target database name, and the directory containing the backup files of the database.
mongorestore.exe --uri "<connectionString>" --db <databaseName> --dir <backupDirectory\databaseName>
mongorestore.exe |
Issue: Copy Activity: Copying data from and to Azure Cosmos DB for MongoDB: "The retrieved type of data JObject is not supported yet"
Hope this helps.
Please don't forget to leave a comment on whether this approach worked for you or not.
Happy Coding.
Regards,
Jaliya
____________________________________________________________________________________________________________________________
- Native MongoDB tools would be recommended for smaller workloads
- Azure Data Factory (ADF) for medium (<1TB)
- Spark if it’s a large dataset (>1 TB)
No comments:
Post a Comment