MongoDB Database Export Import Migration

Source: Internet
Author: User
Tags mongorestore

Export in server 1

/usr/local/mongodb/bin/mongorestore-d adv_new/tmp/mongodb/

It then generates a adv_new directory in the/tmp/mongodb/directory that holds the data files for the Adv_new library.

Import in server 2

Login MONGO to create a new library

/usr/local/mongodb/bin/mongo

> Use adv_new; (You can create a new library directly using use, but show is a new library that you don't see, and you can execute the DB to see the libraries you're using)

Switched to DB adv_new

> Show DBS;
Local 0.078GB

> db;

Adv_new

> Db.users.save ({username: "Tom"}) (must write something to really create the library)

Writeresult ({"ninserted": 1})

> Show DBS;
Adv_new 0.078GB
Local 0.078GB

Start Import

/usr/local/mongodb/bin/mongorestore-d adv_new/tmp/mongodb/adv_new/

MongoDB Database Export Import Migration

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.