If increased read traffic slows your database response, you can add read-only nodes to scale out the read capacity of your cluster. This improves throughput and reduces the load on the primary node (read/write node). Conversely, during off-peak periods, you can remove idle read-only nodes to save costs. The PolarDB cluster endpoint automatically load-balances read requests across the read-only nodes, simplifying connection management for your application.
Prerequisites
Before you begin, ensure that the following conditions are met:
-
Billing method: The target cluster must use the Subscription or Pay-as-you-go billing method.
-
Cluster status: The target cluster must be in the Running state, with no other configuration change tasks in progress, such as changing compute node configurations or performing minor version upgrades.
Impact and limitations
Before adding or removing a read-only node, understand the impacts and limitations to plan the operation accordingly.
Service impact
-
Adding a read-only node: Adding a single read-only node takes approximately 5 minutes. If you add multiple read-only nodes at the same time, they are added in parallel. The actual time required depends on factors such as the cluster workload and the number of databases and tables. Adding a node does not affect your running cluster.
-
Removing a read-only node: When you remove a read-only node, connections to that node experience a transient disconnection, but other nodes are not affected. Perform this operation during off-peak hours and ensure that your application has an automatic reconnection mechanism. If your application connects to a cluster endpoint, PolarDB automatically removes the deleted read-only node from its routing table, so you do not need to modify your application configuration.
Node quantity limits
-
Enterprise Edition:
-
Cluster Edition: A cluster supports up to 15 read-only nodes. You must retain at least one read-only node to ensure high availability. Therefore, you cannot remove the last read-only node.
-
Multi-master Cluster (Limitless) Edition: A cluster supports up to 63 read/write nodes and 15 read-only nodes (global read-only nodes).
-
-
Standard Edition: A cluster supports up to 7 read-only nodes.
Node specification limits
To ensure cluster stability and high availability, the specifications of your primary and read-only nodes are limited as follows:
-
A new read-only node must have at least half the memory of the primary node.
-
The minimum number of CPU cores for a new read-only node depends on the primary node's core count, as follows:
Primary node cores
Minimum read-only cores
2
2
4
4
8
4
16
8
32
16
64
32
88
64
120
64
-
Multi-master Cluster (Limitless) Edition clusters are not subject to these limits.
-
When you add a read-only IMCI node, its specifications should be higher than those of the primary node (read/write node) to accommodate its analytical workload.
Add a node
-
Log on to the PolarDB console. In the left-side navigation pane, click Clusters and select the region where your cluster is deployed.
-
Go to the Add/Remove Node page by using one of the following methods:
-
In the row of the target cluster, click Add/Remove Node in the Actions column.
-
Click the ID of the target cluster to go to the Basic Information page. In the Database Nodes section, click Add/Remove Node.
-
-
In the Add/Remove Node dialog box, select Add Node (or Add Global Read-Only Node), and then click OK.
NoteYou can also add other types of nodes based on your business requirements, such as Add Read-Write Node, Add AI Node, Add Read-only IMCI Node, or Add Search Node.
-
Read/write nodes can be added only to Multi-master Cluster (Limitless) Edition clusters.
-
To add a read-only IMCI node, an AI node, or a search node, make sure that your cluster version meets the requirements for the corresponding feature.
-
-
On the Upgrade/Downgrade page, confirm the Current Configuration. Click the
icon to add a node and select its specifications.NoteYou can click this button multiple times to add multiple nodes at the same time.
-
Choose when you want the configuration change to take effect:
-
Switch Now: The configuration change takes effect immediately.
-
Scheduled Switch: Select a time within the next 24 hours. The task is completed within 30 minutes after the specified time. You can view or cancel the task on the Scheduled Tasks page.
-
-
Read and agree to the terms of service, click Buy Now, and complete the payment. After the payment is successful, the task is executed at your scheduled time.
-
(Optional) If you added other types of nodes, see the following for next steps:
-
Read/write node: You can run the
CREATE DATABASE <name> [POLARDB_WRITE_NODE master_id];statement to create a database on the new node. For more information, see Usage of Multi-master Clusters. -
AI node: You can run an AI SQL statement by adding the
/*polar4ai*/hint at the beginning of the statement. For more information about use cases, see Data-Agent. -
Read-only IMCI node: You can create a columnstore index by adding the
COLUMNAR=1comment to a table or a specific column. For more information, see Add a columnstore index. -
Search node: You can use Elasticsearch-compatible REST APIs to create indexes and search data. For more information, see Use Intelligent Search.
-
Remove a node
Notes
Read/write node
Before you remove a read/write node from a Multi-master Cluster, you must switch the access points of all databases on that node to other available read/write nodes. For more information, see Usage of Multi-master Clusters.
If you do not perform this operation, these databases become inaccessible. If this happens, you can restore access by reassigning a read/write node to these databases. To do this, run the following statement: ALTER DATABASE <name> POLARDB_WRITE_NODE <new_master_id>;.
-
Query the distribution of databases on the read/write node.
SELECT * FROM INFORMATION_SCHEMA.INNODB_CC_GLOBAL_LOCK_INFO WHERE LOCK_MODE = 'SLS_X' AND MASTER_ID = <master_id>; -
Switch the access points for all databases or data objects returned by the query to other read/write nodes.
NoteThe query result may contain an entry named
mysql/global_ddl_lockwith theobjecttypeTable. This entry is for internal use and does not need to be switched.ALTER DATABASE <name> POLARDB_WRITE_NODE <new_master_id>;
AI node
-
After you remove the last AI node, the system immediately purges the node and its associated data, such as vector tables. AI SQL statements sent to the cluster will no longer receive a response. Other SQL statements are not affected.
-
To prevent data loss, back up the necessary data before you remove the node.
Read-only IMCI node
-
After you remove the last read-only IMCI node, the cluster can no longer accelerate queries by using columnstore indexes. If you want to use columnstore indexes again to improve performance, you must add another read-only IMCI node and wait for the columnstore indexes to be automatically rebuilt.
-
The Cluster Endpoint automatically masks failed nodes, so you do not need to modify your application configuration.
Search node
-
After you remove all search nodes, the system immediately purges the nodes and their associated data. REST API requests sent to the cluster will no longer receive a response. Other SQL statements are not affected.
-
To prevent data loss, perform the necessary data backups before you remove the nodes.
Procedure
-
Log on to the PolarDB console. In the left-side navigation pane, click Clusters and select the region where your cluster is deployed.
-
Go to the Add/Remove Node page by using one of the following methods:
-
In the row of the target cluster, click Add/Remove Node in the Actions column.
-
Click the ID of the target cluster to go to the Basic Information page. In the Database Nodes section, click Add/Remove Node.
-
-
In the Add/Remove Node dialog box, select Delete Node (or Delete Global Read-Only Node), Delete Read-Write Node, Delete AI Node, Delete Read-only IMCI Node, or Delete Search Node based on your business requirements, and then click OK.
-
On the Upgrade/Downgrade page, confirm the Current Configuration. Click the minus icon
before the node name to remove the node.NoteYou can remove multiple nodes at once.
-
Choose when you want the configuration change to take effect:
-
Switch Now: The configuration change takes effect immediately.
-
Scheduled Switch: Select a time within the next 24 hours. The task is completed within 30 minutes after the specified time. You can view or cancel the task on the Scheduled Tasks page.
-
-
Read and agree to the terms of service, click Buy Now, and complete the payment. After the payment is successful, the task is executed at your scheduled time.
Billing
Adding or removing nodes affects only compute node fees. Fees for resources such as storage are not affected.
-
Pay-as-you-go
-
You are billed hourly for new nodes from their creation until their release.
-
You can remove nodes at any time to stop billing for them.
-
-
Subscription
-
When you add a node, you must pay a one-time fee for the period from the current time to the cluster expiration date.
-
When you remove a node, the system automatically calculates the remaining value and issues a refund. For more information, see Refund policy for configuration downgrades.
-
FAQ
-
What do I do if an "insufficient resources" error occurs when I add a node?
If the system prompts Insufficient resources. Please try again in another region or zone, it means that the selected specification is sold out in the current zone. We recommend that you perform one of the following actions:
-
Select a similar specification: Try selecting a slightly lower specification.
-
Change the zone. To prevent resource shortages during future scaling operations, manually change the zone.
-
-
Can I add read/write nodes to a PolarDB cluster?
You can add read/write nodes only to Multi-master Cluster (Limitless) Edition clusters. Make sure that your cluster is of this edition.
-
What do I do if the system prompts that no specification change was detected when I add or remove a node?
This message indicates that you have not yet added or removed any nodes. Follow the on-screen instructions: click the
icon to add a node or click the minus icon
before a node name to remove it. -
What do I do if the error
The number of DB nodes is incorrect.occurs when I remove a node?To ensure high availability (HA) and automatic failover, a PolarDB Cluster Edition cluster requires at least one read-only node.
-
When removing nodes, can I keep only one primary node and one read-only IMCI node?
No. To add or retain a read-only IMCI node, you must have at least one regular read-only node in the cluster.
-
My application has high write pressure. Will adding read-only nodes solve the problem?
No. Read-only nodes only handle read (
SELECT) requests. The primary node exclusively handles all write operations (INSERT/UPDATE/DELETE). If the bottleneck is write performance, upgrade the specifications of the primary node instead of adding read-only nodes.
Related topics
-
Impact of node quantity on performance: OLTP performance
-
Read-only IMCI node feature: In-Memory Column Index (IMCI)
-
Search node feature: Intelligent Search (PolarSearch)
-
AI node feature: PolarDB for AI
Related APIs
|
API |
Description |
|
Adds nodes to a PolarDB cluster. |
|
|
Removes nodes from a PolarDB cluster. |