This topic describes how to switch over workloads between primary and secondary ApsaraDB RDS for MariaDB instances. You can enable automatic primary/secondary switchovers for your database system. This way, if the primary RDS instance fails, the system automatically switches your workloads over to the secondary RDS instance. After a primary/secondary switchover, the secondary RDS instance is promoted to run as the new primary RDS instance, and the endpoint that is used to connect to your database system remains unchanged. Your application can use the endpoint to connect to the new primary RDS instance. Automatic primary/secondary switchovers are used to ensure high availability. You can also manually switch your workloads over between the primary and secondary RDS instances.
If you use RDS High-availability Edition, a secondary RDS instance is provided as a standby for the primary RDS instance of your database system. The data of the primary RDS instance is synchronized in real time to the secondary RDS instance. You can access only the primary RDS instance. You cannot access the secondary RDS instance.
If the primary RDS instance fails, your workloads are automatically switched over to the secondary RDS instance.
Usage notes
During a switchover, your service may be interrupted. Make sure that your application is configured to automatically reconnect to the instance.
Procedure
-
Log on to the ApsaraDB RDS console.
-
In the top navigation bar, select the region in which the RDS instance resides.
-
Find the RDS instance and click the ID of the instance.
-
In the navigation pane on the left, click Service Availability.
-
In the Availability Information section, click Switch Primary/Secondary Instance.
-
Select a switchover time and click Ok.
During a primary/secondary switchover, you cannot perform a number of operations. For example, you cannot manage databases and accounts or change the network type. We recommend that you perform a primary/secondary switchover during the planned maintenance window.
NoteIf you want to change the maintenance window, perform the following operations:
-
Click modify.
-
In the Configuration Information section, modify the maintenance window and click Save.
-
Go to the Service Availability page, refresh the page, and continue with the procedure.
-
FAQ
-
Do I need to manually switch my workloads over from the secondary RDS instance to the primary RDS instance after a primary/secondary switchover?
No, you do not need to manually switch your workloads over from the secondary RDS instance to the primary RDS instance after a primary/secondary switchover. The data in the primary RDS instance is the same as the data in the secondary RDS instance. After a primary/secondary switchover, the secondary RDS instance serves as the new primary RDS instance. No additional operations are required.
-
Each time a primary/secondary switchover is performed, my RDS instance does not run as expected 10 minutes after the primary/secondary switchover is complete. What are the possible causes? How do I handle the issue?
A: When an exception triggers a high availability switchover, long-lived connections from your application might not detect the change in connection status. If a socket timeout is not set, the application waits for a response from the database, often disconnecting only after hundreds of seconds. During this period, some database connections do not work correctly, causing many SQL queries to fail. To prevent these invalid connections and reduce recovery time, we recommend configuring the connectTimeout and socketTimeout parameters. This prevents the application from waiting indefinitely during a network error.
Set the timeout values based on your specific workload and usage patterns. For online transaction processing (OLTP) scenarios, a recommended starting point is to set connectTimeout to 1–2 seconds and socketTimeout to 60–90 seconds. These values are for reference only.