MongoDB Replica Set Priority setting

Source: Internet
Author: User
Tags config mongodb
When setting up a MongoDB replica set, the primary node, the second node, the quorum node, and possibly the resource configuration (CPU or memory) are unbalanced, so it is required that some nodes cannot be primary
We know the settings of MongoDB:
In addition to the quorum node, each of the other nodes has a priority, which can be set manually to determine who has the most weight to become a primay.
In a replica set, the priority is determined by setting the value of precedence, the range of which is 0--100, and the higher the value, the greater the priority.
The default value is 1,rs.conf is not displayed;
If the value is 0, it cannot be a primay.


1. When planning is set directly, this is skipped.
2. Join the online node configuration:
Configuration process:
By modifying the value of the priority (the default is 1 (0-100), the greater the value of the priority, the precedence is the primary)
1) primary> config=rs.conf ()
2) primary>config.members[3].priority = 3
3) primary> rs.reconfig (config)
Note: The 2nd step of the members and the _id is not related to the rs.conf, but the order of the values of the nodes to be isolated;

These operations must be on the primary process.

Reference Document: http://docs.mongodb.org/manual/tutorial/force-member-to-be-primary/




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.