You need to enable JavaScript to run this app.
RDS for MySQL

RDS for MySQL

Copy page
Download PDF
Managing connection endpoints
Enabling or disabling read/write separation
Copy page
Download PDF
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.​
  • Stored procedures.​
  • EXECUTE statements.​
  • 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.​
  • USE commands.​
  • 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​
  1. Log on to the RDS for MySQL console.​
  1. 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.​
  1. On the left navigation bar, click Instances to go to the Instances page.​
  1. On the Instances page, click the name of the target instance to enter the instance.Instances​
  1. On the target instance page, click Connectivity.​
  1. 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.​
  1. 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.​
  1. 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​
  1. Select the assignment mode for the Read/Write splitting strategy. The automatic assignment mode is used by default. For more details, refer to Setting the read/write separation policy.​
  1. Click OK.​
Related API​
​
API​
Description​
Call the ModifyDBEndpoint API to modify an Endpoint.​
​
​
Last updated: 2025.10.16 18:09:12