[Mongodb] Problems

Source: Internet
Author: User

1. MongoDB Backup

[Email protected] ~]# mongodump  192.168.  1.122 -D users-o/backup/20170228/users

2. MongoDB Recovery

192.168. 1.122 -D users/backup/20170228/users/users/

3. MongoDB Duplicate Name Set

Format: # db.copydatabase (' From database ', ' to database ', ' from Host:port ');

Rs0:primary> Db.copydatabase ('Users',' Person','192.168.1.122:27019')  { "OK":1}rs0:primary>Show Dbslocal0. 006GBperson0. 000GBusers0. 000gbrs0:primary>Use usersswitched to DB usersrs0:primary>db.dropdatabase () {"dropped":"Users","OK":1}

4. mongdb replica centralization of weight

Mongdb front-end add Haproxy do ha, when a MongoDB service down, proxy can be connected to another service, because MongoDB initializes the same weight, so you need to modify the weight to determine the redundant node.

The greater the MongoDB weight, the more priority is given to the primary node

Rs0:primary> config=rs.conf () rs0:primary> config.members[0rs0:primary > config.members[19rs0:primary> config.members[28Rs0 :P rimary> rs.reconfig (config)

These operations must be on the primary process.

5. Mongdb Log Too big problem


MongoDB log files in the case of setting logappend=true, will continue to the same log file appended, long time, naturally become very large.
The solution is as follows: (Special note: The log path must be--logpath specified when booting)

rs0:primary> use adminrs0:primary> Db.runcommand ({logRotate:1})

This will generate a new log file.

[Mongodb] Problems

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.