To meet data reading performance requirements in various business scenarios, the number of nodes in a replica set instance can be changed in ApsaraDB for MongoDB. Data can be read from added secondary nodes. This method improves the overall read performance of replica set instances.
You can add or remove nodes for a replica set instance. The number of nodes must be kept at least three however you change them. The changes to the node result in a change to the instance billing. For more information, see Billing items and pricing.
- Log on to the ApsaraDB for MongoDB console.
- In the upper-left corner of the page, select the region of the instance.
- In the left-side navigation pane, click Replica Set Instances.
- Locate the instance and click the instance ID.
- On the Basic Information page, follow these steps based on the billing method of the instance:
- For pay-as-you-go instances, click Upgrade or Downgrade in the Basic Information section.
- For subscription-based instances, click Change Configuration in the Basic Information section.
- On the Change Configuration page, select Replication Factor.
- Set Migration Time.
- Switch Immediately After Data Migration: After the configuration change process is completed, the instance immediately enters
the Changing Configuration state. The configuration is successfully changed when the status of the instance
changes to the Running status.
During some configuration upgrades, the instance may be disconnected for less than 30s once or twice. You can set the effective time for the configuration change as required to avoid negative effects on your business.
- Migrate at Scheduled Time: You can set the time for the configuration change within a specified period. For
more information, see Specify a maintenance period.
If the network of an instance is not disconnected during the configuration change, the configuration change can immediately take effect regardless of whether you have set the migration time.
- Switch Immediately After Data Migration: After the configuration change process is completed, the instance immediately enters the Changing Configuration state. The configuration is successfully changed when the status of the instance changes to the Running status.
- Select ApsaraDB for MongoDB Agreement of Service and follow the instructions to complete the payment.
What to do next
After you add the nodes for the replica set instances, the connection addresses of new nodes (all displayed as Secondary, only different for role IDs) appear in the console. The connection string URI for a high availability connection is also updated. You can modify the connection address in an application to achieve high availability and read/write splitting connection and improve the overall performance. For more information, see Connect to a replica set instance through the mongo shell.