Help Center/ GaussDB(for MySQL)/ User Guide/ Application Lossless and Transparent (ALT)/ Example: Using ALT to Promote a Read Replica to Primary
Updated on 2024-11-06 GMT+08:00

Example: Using ALT to Promote a Read Replica to Primary

This section describes how to use ALT to promote a read replica to primary. The process for minor version upgrades and specification changes is similar.

The process for using ALT to promote a read replica to primary is as follows:

Step 1: Buy a GaussDB(for MySQL) Instance

Step 2: Create a Proxy Instance

Step 3: Enable ALT

Step 4: Connect Your Application to the Proxy Instance

Step 5: Promote a Read Replica to Primary

Step 6: Test the ALT Effect

Constraints

If workloads are interrupted, see Precautions.

Step 1: Buy a GaussDB(for MySQL) Instance

For details, see Buying a DB Instance.

Step 2: Create a Proxy Instance

For details, see Step 1: Create a Proxy Instance.

Step 3: Enable ALT

For details, see Enabling ALT.

Step 4: Connect Your Application to the Proxy Instance

For details, see Step 4: Use the Proxy Address to Connect to Your GaussDB(for MySQL) Instance.

Step 5: Promote a Read Replica to Primary

For details, see Promoting a Read Replica to Primary.

Step 6: Test the ALT Effect

If ALT is enabled and you promote a read replica to primary using sysbench, tpcc-mysql, or a MySQL client that is connected to the proxy address, your database only freezes briefly.

The following figures show you what effect ALT has when you promote a read replica to primary using sysbench, tpcc-mysql, and a MySQL client.

  • Promoting a read replica to primary using sysbench

  • Promoting a read replica to primary using tpcc-mysql

  • Promoting a read replica to primary using the MySQL CLI

    As shown in the following figure, user-defined variables, session variables, and databases remain unchanged before and after you promote a read replica to primary.

    The following figure shows how the transaction draining timeout interval determines whether ALT is available for the current session.