Overview
This topic describes how to read /write splitting to apsaradb RDS for MySQL instances.
Detail
The MySQL instance read /write splitting involves the following knowledge points.
-
Transactions and stored procedure are sent to the Master instance for execution.
-
When the synchronization delay of a read-only Slave instance exceeds the threshold, the Slave node sends a request to the Master instance.
-
The number of connections to the read /write splitting address depends on the minimum number of connections in the Master instance and read-only Slave instance, rather than the sum of connections in all instances.
-
The whitelist of read /write splitting addresses depends on the whitelist of the Master instance.
-
Special circumstances description.
-
The latter two select statements request the Master instance.
set autocommit=0; update xxx select xxx select xxx
-
The first select statement requests the read-only Slave instance, the update statement and subsequent statements request the Master instance. Therefore, all select statements created before the first update statement send requests to read-only Slave instances. However, you must use the read-only weights specified for these Slave instances.
set autocommit=0; select xxx update xxx select xxx
-
Statements starting with start or begin request from the Master instance.
Application scope
-
Apsaradb RDS for MySQL