When an instance added to the database proxy becomes unavailable due to an exception, the database proxy will forward SQL statements to another instance for execution or discard SQL statements and generate error information based on SQL statement forwarding policies for instance faults. This document describes the settings and principles of the forwarding policies.
Background
During operation, a database instance may become unavailable due to various exceptions, such as server power outages, restarts, and network interruptions. The TDSQL-C for MySQL database proxy provides capabilities of SQL statement forwarding upon instance faults to avoid business unavailability due to SQL execution errors when an instance exception occurs.
Prerequisites
Forwarding Policies
The current database proxy supports the following SQL statement forwarding policies for instance faults:
If a read-only instance and a read-write instance are faulty, the database proxy will send SELECT statements to a normal instance for execution by default.
If a read-write instance is faulty, the database proxy will report an error for the execution of DML or DDL statements.
If a read-only analysis engine under the database proxy is faulty, the database proxy will forward SQL statements to a normal read-only analysis engine for execution.
If all read-only analysis engines under the database proxy are faulty, the system will return an execution error with the error message "no backend server".
Note:
Currently, the above instance fault forwarding policies cannot be modified. By default, SQL statement forwarding upon read-only instance and read-write instance faults is enabled, while forwarding upon read-only analysis engine faults is disabled.
Operation Steps
1. Log in to the TDSQL-C for MySQL console, select the cluster for which the database proxy is enabled in the cluster list, and then click the Cluster ID to enter the Cluster Management page. 2. Choose Cluster Management > Cluster Details to go to the topology, hover over the Database Proxy section, and then click Details to go to the Database Proxy Management page. Alternatively, click the Database Proxy tab on the Cluster Management page to go to the Database Proxy Management page.
3. On the Database Proxy Management page, select Overview. Find the access address to be modified under the connection address, and click Adjust Configuration in the corresponding Operation column to go to the Adjust Configuration page. You can view SQL statement forwarding policies for instance faults for different types of instances on this page.
4. After Failover is enabled, when a read-only instance is faulty, SQL statements that should be forwarded to the read-only instance will be forwarded to a read-write instance by default. After Forwarding Upon Analysis Engine Faults is enabled, when a read-only analysis engine is faulty, SQL statements will be preferentially forwarded to a normal read-only analysis engine by default and then forwarded to a read-only instance. If the read-only instance is also faulty, the SQL statements will be forwarded to a read-write instance by default.
Note:
SQL statement forwarding upon read-only analysis engine faults is supported only when the database proxy version is 1.4.5.
Related APIs
|
| This API (ModifyProxyRwSplit) is used to configure database proxy read-write splitting. |