MongoDB backup and recovery data

Source: Internet
Author: User
Tags install mongodb mongodb download mongodb server mongodump mongorestore
Backup and recovery are required for any database, which is of much importance and everyone understands. MongoDB also provides backup and recovery functions, which are under the MongoDB download directory.

Backup and recovery are required for any database, which is of much importance and everyone understands. MongoDB also provides backup and recovery functions, which are under the MongoDB download directory.

Backup and recovery are required for any database. The importance of backup and recovery is not enough.

Mongodbalso describes the functions of tracing and restoration, which are the mongdump.exeand mongorestore.exe files downloaded by mongodb.

First, let's talk about the Syntax:

Backup:

> 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.

Instance:> mongodump-h 127.0.0.1-d test-o c: \ data \ dump \

Recovery:

> 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 and used with caution!

Instance:> mongorestore-h 127.0.0.1-d test -- directoryperdb c: \ data \ dump \ test

MongoDB details: click here
MongoDB: click here

Related reading:

MongoDB backup and recovery

CentOS compilation and installation of MongoDB

CentOS compilation and installation of php extensions for MongoDB and mongoDB

CentOS 6 install MongoDB and server configuration using yum

Install MongoDB2.4.3 in Ubuntu 13.04

How to create a new database and set in MongoDB

MongoDB beginners must read (both concepts and practices)

MongoDB authoritative Guide (The Definitive Guide) in English [PDF]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.