All Products
Search
Document Center

ApsaraDB RDS:Configure the read attribute for a secondary RDS instance

Last Updated:Nov 06, 2024

In RDS Cluster Edition for ApsaraDB RDS for SQL Server, your database system consists of a primary RDS instance and a secondary RDS instance. These instances work in high availability (HA) mode. After you enable read/write splitting, the secondary RDS instance becomes readable and serves as a read-only RDS instance. This helps reduce the costs of cloud migration.

Prerequisites

  • The primary RDS instance meets the following requirements:

    • The primary RDS instance runs SQL Server 2017 EE (Always On), SQL Server 2019 EE (Always On), or SQL Server 2022 EE (Always On).

    • The primary RDS instance runs RDS Cluster Edition.

    • The primary RDS instance uses Enterprise SSDs (ESSDs) or general ESSDs.

    Note

    You can go to the Basic Information page of the primary RDS instance to view the preceding information.

  • The read/write splitting feature is enabled for the primary RDS instance. For more information, see Implement read/write splitting by enabling the read-only routing endpoint.

Feature description

  • After you create an RDS instance that runs RDS Cluster Edition, a primary RDS instance and a secondary RDS instance are automatically provisioned.

    • If you do not enable read/write splitting for the primary RDS instance, only the primary RDS instance is readable and writable. After you enable read/write splitting, the secondary RDS instance becomes readable.

    • After you enable read/write splitting for the primary RDS instance, the secondary RDS instance becomes readable. You can specify read weights for the primary RDS instance, the secondary RDS instance, and the read-only RDS instances that you create for the primary RDS instance. For more information, see Procedure.

  • If you use an existing primary RDS instance that runs RDS Cluster Edition, take note of the following items:

    • If you enable read/write splitting for the primary RDS instance, the secondary RDS instance is readable by default.

    • If you do not enable read/write splitting for the primary RDS instance, you can enable read/write splitting and then specify the read weights for the read-only RDS instances of the primary RDS instance. For more information, see Procedure.

Procedure

  1. Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.

  2. In the left-side navigation pane, click Cluster Management.

  3. In the Basic Information section, click Configure Readonly Splitting Address . In the dialog box that appears, set Read Weight Distribution to Customized Distribution and specify a read weight for each RDS instance.

    image

    A higher read weight indicates more read requests to process. For example, if the primary RDS instance has three read-only RDS instances whose read weights are 100, 200, and 200, the read-only RDS instances process read requests at a ratio of 1:2:2.

    • Automatic Distribution: The system assigns a read weight to each read-only RDS instance based on the instance specifications. After you create a read-only RDS instance, the system automatically assigns a read weight to the created read-only RDS instance. You do not need to specify a read weight for the new read-only RDS instance. For more information, see Rules of weight allocation by the system.

    • Customized Distribution: You must specify a read weight for each RDS instance in your database system. Valid values: 0 to 10000. By default, the read weight of a read-only RDS is 0. After you create a read-only RDS instance, you must specify a read weight for the read-only RDS instance based on your business requirements.

    Note

    If you delete a read-only RDS instance, its read weight is also removed, but the read weights of other RDS instances remain unchanged.

  4. Click OK.

Related operations

You can call an API operation to apply for a read-only routing endpoint. For more information, see AllocateReadWriteSplittingConnection.