![]() If you want to take the backup of a specific database and a specific collection using mongodump command you can specify -db and -collection as options to mongodump. Backup of a specific collection and a specific database using mongodump So, it is better to ensure that, you no longer need the files in the output folder or you have taken a copy of the previous backup folder, before to run the mongodump command multiple times. ![]() : The mongodump command overwrites output files if they already exist in the backup data folder. T11:01:51.858+0530 Metadata for erdetails to /backup_data/backup/test\ T11:01:51.696+0530 Metadata for erdetails to /backup_data/backup/myinfo\ T11:01:51.696+0530 erdetails to /backup_data/backup/myinfo\userdetails.bson Here is the output D:\mongodb\bin>mongodump -out /backup_data/backup/ D:\mongodb\bin>mongodump -out /backup_data/backup/ Here in the example below we mention the directory under D: is backup_data/backup/ folder. You can take the backup in specific directory by using the -out or -o option. Backup a Database with mongodump specify different output directory Here is the output D:\mongodb\bin>mongodump -host mypc-PC -port 27017 D:\mongodb\bin>mongodump -host mypc-PC -port 27017 Here in the example below the host is mypc-PC and port is the default port 27017. T16:12:38.413+0530 DATABASE: admin to dump\adminīackup a Database with mongodump specify the -host and -port Here is the output D:\mongodb\bin>mongodump Here our path is D:\mongodb\bin and you have to execute the command from here. To take the backup you have to enter the bin directory into the mongodb folder on your machine. Here is the command to backup data from a mongod or mongos instance running on the same machine and on the default port of 27017. localhost) on port 27017 and creates a database backup named dump/ in the current directory. When mongodump only runs without any arguments, the command connects to the MongoDB instance on the local system (e.g. The backup utility of MongoDB can create a backup for an entire server, database or collection, or you can use a query to backup for a part of a collection. Here, in this article, we will describe the process for creating backups and restoring data using the utilities provided with MongoDB MongoDB Backup On that vital moment, you can keep safe by restoring your data if you have a backup of your valuable data. This utility is important because your valuable data can be removed or crashed or corrupted from your server, your local machine by accidentally or by any mistake, whatever it may be. The Backup and Restore in MongoDB is an important part to handle a database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |