MongoDB remote connection and Import Export data

Source: Internet
Author: User
Tags mongodump

One, remote connection MongoDB

Connection command:mongo-u username-p pwd 192.168.41.215:27017/database (database for user name)

Second,mongodump backup Database

Export command:mongodump-h IP--port Port-u user name-p password-d database-o file exists path

  Detailed Explanation:

    The server address where the-H:MONGODB is located (must specify a port), if not specified, is the local 127.0.0.1:27017

-U: User name

-P: Password

-D: The database that needs to be backed up (export entire mongodb is removed)

-O: Where the backed up data resides

Here is the section (export the entire MongoDB, or you can specify to export a database):

     

Third,mongodump backup Database

Format:mongorestore-h IP--port Port-u user name-p password-d database--drop file exists path

--drop is the first to delete all the data, and then restore, the following is the newly exported 4 databases data

   

  

Here's how to recover all the data:

  

Here is the recovery of the specified library:

Cond......

  

Reference from: http://blog.51yip.com/nosql/1573.html

MongoDB remote connection and Import Export data

Related Article

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.