Create Backup in MongoDB
The mongodump command in MongoDB
To create a database Backup in MongoDB, you should use the mongodump command. This command will dump all Server data into dump directory. There are many options available from which you can limit the amount of data or backup created by Remote Server.
Syntax
The basic syntax of the mongodump command in MongoDB is:
> mongodump
For example
Start Mongod Server. Suppose your server is running on locallhost and port 27017. Now, open a command prompt and go to the bin directory of Mongodb Instance, then compose the mongodump command.
You monitor the Collection named mycol with the following data:
> mongodump
This command will connect to the running Server at 127.0.0.1 and port 27017 and backup the entire data of the Server to the / bin / dump directory . The result of this command is as follows:
Here are some available options that can be used with the mongodump command.
Syntax Description mongodump --host HOST_NAME --port PORT_NUMBER This command will back up all databases of the mongodump --host definedspoint.com --port instance 27017 mongodump --dbpath DB_PATH - out BACKUP_DIRECTORY This command only backs up the database specified in the given path. mongodump --dbpath / data / db / --out / data / backup / mongodump --collection COLLECTION --db DB_NAME This command only backs up the specified Collection of the database with the --collection mycol --db kiểm TRAData recovery in MongoDB
To restore backed up data in MongoDB, use the mongorestore command. This command restores all data from the backup folder.
Syntax
The basic syntax of the mongorestore command is:
> mongorestore
The result of the order is:
According to Tutorialspoint
Previous post: Shard in MongoDB
Next article: MongoDB Deployment
You should read it
May be interested
- Learn about security features and authentication in MongoDBin the following article, we will continue to introduce security and authentication features in the mongodb database management system series. in essence, the basic account validation feature is available in mongodb, but has been disabled in default mode, and in this mode the system requires at least 1 active database ...
- Capped Collection in MongoDBcapped collections are fixed-sized circular collection that follow the insert order to enhance the performance of create, read, and delete operations.
- Instructions to create a backup password on Zaloto ensure that the backup of messages on zalo is always safe in case you lose your phone or when your zalo account is hacked, users should set a backup password on zalo.
- Advanced index operation in MongoDBcreate an index on the array ie create separate indexes for each of its fields. so in this situation, when we create an index on the array of tags, individual indexes will be created for their values: music, cricket and blogs.
- How to use Backup and Restore on Windows 7?the backup and restore utility integrated on previous windows versions is less user-friendly than using third-party applications. in the following article, network administrator will guide you how to use backup and restore on windows 7 - one of the best backup tools today.
- Shard in MongoDBsharding is a process of storing data records across multiple devices and it is a method of mongodb to meet the requirement for increasing data. when the size of the data increases, a single device cannot be enough to store data.
- Learn about Java Driver in MongoDBin the following article, we will introduce you some basic features of mongodv java driver as well as how to deploy and apply in practice.
- Install MongoDBinstructions for installing mongodb on windows.
- Map Reduce in MongoDBin mongodb documentation, map-reduce is a data processing system that condenses a large amount of data into useful overall results. mongodb uses mapreduce command for map-reduce operation. in general, map reduce is used to handle large data sets.
- Aggregation in MongoDBaggregation can be understood as aggregation. the aggregation operation handles data records and returns calculated results. the operations group the values from multiple documents together, and can perform multiple operations on the grouped data to return a single result. in sql, count (*) and group by are equivalent to aggregation in mongodb.