- Documentation
RDS for MySQL
User guide
Managing connections
Managing connection endpoints
Enabling or disabling read/write separation
Managing connection endpoints
Enabling or disabling read/write separation
Enabling or disabling read/write separation
After you enable read/write separation for an instance, you can configure it to forward read requests to read-only nodes to reduce the read workload on the primary node. This topic describes how to enable read/write separation for a database.
Background
After you enable read/write separation, requests are forwarded as follows:
- Sent only to the primary node
- INSERT、UPDATE、DELETE、SELECT FOR UPDATE、SELECT LOCK IN SHARE MODE。
- All user operations (such as CREATE/DROP/GRANT USER).
- All DDL operations (such as creating or deleting tables and databases, or altering table structures).
- All requests within transactions (including SET autocommit=0).
- LOCK-related statements.
- User-customized functions.
- Requests that use temporary tables.
- SELECT last_insert_id()。
- All queries and changes to user variables.
- KILL (KILL in SQL statements, not the KILL command).
- Locking functions in query statements.
- Sent to the read-only node or primary node
- SELECT statements outside of a transaction.
- SHOW VARIABLES statements outside of a transaction.
- COM_STMT_EXECUTE commands.
- Always sent to all nodes
- Changes to all system variables.
- SHOW PROCESSLIST (The proxy returns aggregated PROCESSLIST information for all nodes).
- COM_STMT_PREPARE commands.
- Commands such as COM_CHANGE_USER, COM_QUIT, and COM_SET_OPTION.
Precautions
Only the Read/Write mode proxy connection endpoints of double-node and multiple-node instances support this feature.
Prerequisites
- An instance has been created and is in the Running status. For specific operations, refer to Creating an instance.
Procedure
- In the upper-left corner of the top menu bar, select the project and region for the instance.
tip
If the project to which the instance belongs is not set, this operation should select the project as All resources.
- On the left navigation bar, click Instances to go to the Instances page.
- On the Instances page, click the name of the target instance to enter the instance.Instances
- On the target instance page, click Connectivity.
- On the Connectivity tab, in the Endpoints list, click Edit in the Actions column of the target connection endpoint to go to the Modify endpoint page.
- On the Modify endpoint page, in the Read/Write separation configuration section, turn on the Read/Write separation switch.
tip
To disable the read/write separation feature, turn off the Read/Write separation switch and click OK. No other actions are needed.
- Set the read-only latency threshold. The value range for this setting is 1 to 3600s. After the threshold is set, read-only requests are not assigned to read-only nodes whose latency exceeds the specified threshold.
tip
Only the Default_endpoint and customized Read/Write Endpoints support setting the read-only latency threshold.Default_endpointDefault_endpoint
Related API
Last updated: 2025.10.16 18:09:12