MongoDB backup and recovery (mongorestore) do not need to think about it, data backup is required at any time, especially important data. Mongodbalso describes the functions of tracing and restoration, which are the mongdump.exeand mongorestore.exe files downloaded by mongodb. First, we will introduce the command syntax: mongodump-hdb.
MongoDB backup and recovery (mongorestore) do not need to think about it, data backup is required at any time, especially important data. Mongodbalso describes the functions of tracing and restoration, which are the mongdump.exeand mongorestore.exe files downloaded by mongodb. First introduce the command syntax: mongodump-h db
MongoDB backup and recovery (mongorestore)
You don't have to think about it. Data Backup is required at any time, especially important data.
Mongodbalso describes the functions of tracing and restoration, which are the mongdump.exeand mongorestore.exe files downloaded by mongodb.
First, we will introduce the command syntax:
> Mongodump-h dbhost-d dbname-o dbdirectory
-H: the address of the MongDB server, such as 127.0.0.1. You can also specify the port number 127.0.0.1: 27017.
-D: The database instance to be backed up, for example, test
-O: The storage location of the backup data, for example, c: \ data \ dump. Of course, this directory must be created in advance. After the backup is complete, the system automatically creates a test directory under the dump directory, which stores the backup data of the database instance.
> Mongorestore-h dbhost-d dbname -- directoryperdb dbdirectory
-H: Address of the MongoDB Server
-D: The database instance to be restored, for example, test. Of course, this name can be different from that during backup, for example, test2.
-- Directoryperdb: the location where the backup data is located, for example, c: \ data \ dump \ test. Why should we add another test instead of dump during Backup? Read the prompt on your own!
-- Drop: Delete the current data and restore the backup data. That is to say, after the restoration, all the data added and modified after the backup will be deleted. Use it with caution!
Instance operation: