Backing up any kind of data store is essential for business continuity point of view. Use of MongoDB does not exclude any application from not having to back up the database and collections on regular basis. In this post, I will show how to use mongodump command line utility to backup on-premises deployment of MongoDB.
mongodump is a command line utility. It is not shipped and install with MongoDB server. You will need to download and install it separately. You can use following link to get the command line Tools that you can install.
You will use following command to backup a database.
mongodump /uri:mongodb://my-blockchain /out:C:\Devleopment\MongoBackups\MyDbBackups /db:ByteBlocks /username:mydbuser /password:mydbuserpassword /authenticationDatabase:ByteBlocks /gzip
There are more option to have finer control on backup process. The above command and options are minimum you will need to perform the operation. If there is any issue with options, you could run into errors when running the command line. Following are some of the errors that are commonly observed.
Failed: can't create session: could not connect to server: connection() error occurred during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.The above error is thrown when you have not specified correct authentication credentials.
Failed: error creating intents to dump: error getting collections for database `xxxx`: (Unauthorized) not authorized on xxxxx to execute command { listCollections: 1, filter: {}, cursor: {}, lsid: { id: UUID("bd7290d9-e552-46cc-8c28-5052e0c94697") }, $db: "xxxxxx" }The above error means that the user you are using does not have rights to perform backup operations. To fix this issue, you will need to grant backup role to the user.
This is all you will need to create backup of your MongoDB databases.
How to backup MongoDB database
The database principal owns a database role and cannot be dropped
Develop password recovery test use cases using ChatGPT
The request does not support the API version
The tag helper 'option' must not have C# in the element's attribute declaration area
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2023 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use