Mongodb replica set priority settings, mongodb replica priority
When you set a mongodb replica set, the Primary node, second node, and arbitration node may have unbalanced resource configurations (CPU or memory). Therefore, some nodes must not be Primary.
We know mongodb settings:
In addition to the arbitration node, each other node has a priority. You can manually set the priority to determine who has the highest weight as primay.
In a replica set, the priority value is determined by setting the priority value. The value ranges from 0 to. A larger value indicates a higher priority.
The default value is 1, and rs. conf is not displayed;
If the value is 0, it cannot be primay.
1. Set it directly during planning. This is skipped.
2. Online node configuration:
Configuration process:
By modifying the value of priority (the default priority is 1 (0-100). The larger the value of priority is, the higher the priority is)
1) PRIMARY> config = rs. conf ()
2) PRIMARY> config. members [3]. priority = 3
3) PRIMARY> rs. reconfig (config)
Note: The members and _ IDs in the braces in step 1 members do not have a relationship, but rs. conf finds out the order of node values;
These operations must be performed on the Primary process.
Reference: http://docs.mongodb.org/manual/tutorial/force-member-to-be-primary/