All Products
Search
Document Center

ApsaraDB RDS:Perform a primary/secondary switchover

Last Updated:Mar 28, 2026

ApsaraDB RDS for MariaDB supports automatic and manual primary/secondary switchovers. During a switchover, the secondary instance is promoted to primary, and the original primary becomes the new secondary. The endpoint stays the same — your application reconnects to the new primary without any configuration changes.

With RDS High-availability Edition, one secondary instance runs as a hot standby. Data is synchronized in real time from the primary to the secondary. If the primary RDS instance fails, your workloads are automatically switched over to the secondary RDS instance. You can access only the primary RDS instance. You cannot access the secondary RDS instance.

When to perform a manual switchover

Perform a manual switchover in these situations:

  • Planned maintenance: Switch workloads to the secondary before performing maintenance on the primary.

  • Failover drill: Test your application's ability to recover from a database failure.

  • Connection timeout validation: Verify that connectTimeout and socketTimeout are configured correctly before going to production.

Limitations

Keep the following in mind before starting a switchover:

  • Service interruption: A brief service interruption occurs during the switchover. Make sure your application is configured to automatically reconnect.

  • Restricted operations: During a switchover, you cannot manage databases or accounts, or change the network type.

  • Maintenance window: Perform the switchover during your planned maintenance window to minimize impact.

Prerequisites

Before you begin, make sure you have:

  • An ApsaraDB RDS for MariaDB instance running RDS High-availability Edition

  • Access to the ApsaraDB RDS console

  • An application configured to automatically reconnect to the database

Trigger a manual switchover

  1. Log on to the ApsaraDB RDS console.

  2. In the top navigation bar, select the region where the instance resides.

  3. Find the instance and click its ID.

  4. In the left-side navigation pane, click Service Availability.

  5. In the Availability Information section, click Switch Primary/Secondary Instance.

  6. In the dialog box, specify a switching time, then click OK.

To switch within your maintenance window, click modify to the right of the Switch Within Maintenance Window option. In the Configuration Information section, select a maintenance window and click Yes. Return to the Service Availability page, refresh it, and then continue.

FAQ

Do I need to switch back after a primary/secondary switchover?

No. After the switchover, the secondary becomes the new primary and starts serving your workloads. The data is identical on both sides — no additional steps are required.

My instance doesn't perform well for about 10 minutes after a switchover. What's happening?

This happens when your application doesn't detect the connection change quickly enough. Without socket timeout settings, your application waits for the database to return the results. In most cases, your application is disconnected after hundreds of seconds. During this period, some connections to the database cannot work as expected, and a large number of SQL statements fail to be executed.

To reduce recovery time, configure connectTimeout and socketTimeout in your JDBC connection settings. For online transaction workloads, set connectTimeout to 1–2 seconds and socketTimeout to 60–90 seconds. These values are a starting point — adjust them based on your workload characteristics.