It is because mongodump can export / import data in BSON format and thus reliably preserves rich data types.īelow is one of the sample runs: Using mongodump to export data from Cosmos DB Also mongodump is always better and recommended option than using mongoexport. Since Cosmos DB has strict SSL requirements, we’ll need to use ssl parameter. Mongodump.exe –host -u -p –ssl –sslAllowInvalidCertificates –out Now, we can backup content simply by using below command: By default this should be C:\Program Files\MongoDB\Server\3.6\bin\ on the machine where Mongo DB is installed. Go to location where you have install Mongo DB and then navigate to bin folder. Note down the host, port, username and password mentioned in the portal:Ĭonnection details for Azure Cosmos DB Backup / Restore Azure Cosmos DB at command line window Grab Azure Cosmos DB connection detailsįor this, go to Azure Portal -> Search for cosmos db in reference -> Select the cosmos DB -> Connection String. Mongo DB is available for download from MongoDB download center. To get them to work, we’ll first need to install Mongo DB either on a physical / virtual machine located on-prem / cloud. We’ll be using native mongo db executable for backup / restore of data from cosmos database. Using it is not intuitive enough and it does not currently support Azure Cosmos DB MongoDB API either as a source or as a target. Microsoft does provide an Data Migration tool which can be used further scripted but it has two major limitations. In this blog post, we’ll learn how to backup / restore data from Azure Cosmos Database using Mongo DB API. Or for some reason the connectivity to internet is broken but your developers still need to work on a critical feature. Now what happens if you figure out after 8 hours that your data is lost or if its corrupted in your development / staging environments or something accidentally went wrong with production while everyone was on holidays. If the data is accidentally dropped or corrupted, you can contact Azure support within eight hours. These automated backups are currently taken approximately every four hours and latest 2 backups are stored at all times. Azure Cosmos Database (formerly known as Azure DocumentDB) is a PaaS offering from Microsoft Azure. As a document store, it falls into the same category as MongoDB, CouchDB or RethinkDB and other No SQL DBs and just like those, it handles documents in the JSON format.Īzure Cosmos DB automatically takes backups of all your data at regular intervals.
0 Comments
Leave a Reply. |