This topic describes how to configure a read-only routing endpoint to enable the read/write splitting feature for a MyBase for SQL Server Always On instance. If you need to split read and write requests, configure a read-only routing endpoint. The read/write splitting feature allows ApsaraDB for MyBase to route write requests to the primary instance and read requests to the read-only instances. The read requests are routed based on the read weights of the read-only instances.

Background information

You can increase the number of read-only instances for a MyBase for SQL Server Always On instance. For more information, see Create a read-only instance.

Procedure

  1. Find the dedicated cluster that you want to manage, and click Details in the Actions column.
  2. In the left-side navigation pane, click Instances.
  3. Find the instance that you want to manage and click Details in the Actions column. You are redirected to the ApsaraDB RDS console.
  4. In the left-side navigation pane, click Cluster management. On the page that appears, click Enable now.
  5. In the Configure Readonly Splitting Address dialog box, configure the following parameters.
    Parameter Description
    Network Type
    • Intranet address (VPC): MyBase for SQL Server 2017 Enterprise Edition Always On and MyBase for SQL Server 2019 Enterprise Edition Always On support only virtual private clouds (VPCs).
    • Internet Address: the public endpoint that is used to connect to the instance over the Internet. We recommend that you use a private endpoint to connect to the instance. If the instance is connected over the Internet, transient connections may occur.
    Read Weight Distribution

    The method that is used to assign read weights. The higher the weight of a read-only instance, the more read requests are routed to the read-only instance for processing. For example, if the primary instance has three read-only instances whose read weights are 100, 200, and 200, the three read-only instances process read requests at a 1:2:2 ratio.

    • Automatic Distribution: Your database system assigns a read weight to each read-only instance based on the instance specifications. If you select this option, each time a read-only instance is created for the primary instance, your database system assigns a read weight to the read-only instance and adds the read-only instance to the read/write splitting link.
    • Customized Distribution: You can customize the read weight of each read-only instance. The weight can range from 0 to 10000 and must be an integer multiple of 100. If you select this option, each time a read-only instance is created for the primary instance, your database system sets the read weight of the read-only instance to 0. You must manually modify the read weight of the read-only instance.
    Note
    • If the primary instance fails or the synchronization between the primary instance and read-only instances times out, the read weights automatically become invalid. After you restore the primary instance, the read weights become valid again.
    • After the primary instance is released, the read weights of the read-only instances become invalid.