This topic describes how to enable the read-only routing endpoint for a primary ApsaraDB RDS for SQL Server instance. ApsaraDB RDS for SQL Server allows you to manage read-only instances and provides a read-only routing endpoint. You can configure the endpoint of the primary instance and the read-only routing endpoint in your application. The system distributes write requests to the primary instance and read requests to the read-only routing endpoint. The read-only routing endpoint then distributes the read requests to the read-only instances based on the specified read weights.

Prerequisites

  • The RDS instance is a primary instance.
  • The RDS instance runs SQL Server 2017 on RDS Cluster Edition.
  • The RDS instance has at least one read-only instance. For more information about how to create a read-only instance, see Create a read-only ApsaraDB RDS for SQL Server instance.

Precautions

  • If it is the first time that you enable the read-only routing endpoint, your database system automatically upgrades the backend administration systems of the primary and read-only instances to the latest version. This ensures service availability. While the read-only routing endpoint is being enabled, the primary instance is disconnected for 30 seconds or less. All of the read-only instances are inaccessible during the brief disconnection. To avoid interruptions to your business, we recommend that you enable the read-only routing endpoint during off-peak hours and make sure that your application is configured to automatically reconnect to the primary instance.
  • If you have restarted or changed the specifications of the primary and read-only instances at least once after March 8, 2017, your database system has upgraded. This includes the upgrade of the backend administration systems of these instances to the latest version. In this situation, when you enable the read-only routing endpoint, your database system does not restart these instances and no brief disconnection occurs.
  • The generated read-only routing endpoint is fixed. It does not change even when you enable and disable the read-only routing endpoint multiple times. You do not need to perform a regular update of the configuration data on your application. This reduces maintenance costs.
    Note The read-only routing endpoint cannot be manually modified.
  • The read-only routing endpoint is free of charge. However, you still need to pay for the read-only instances that you create.
  • The read-only routing endpoint is unavailable in a classic network.

Procedure

  1. Log on to the ApsaraDB for RDS console.
  2. In the top navigation bar, select the region where the target RDS instance resides.Select a region
  3. Find the target RDS instance and click its ID.
  4. In the left-side navigation pane, click Cluster management.
  5. Click Enable now.
  6. Configure the following parameters.
    Parameter Description
    Network Type The type of the read-only routing endpoint.
    • Intranet address: RDS instances running SQL Server 2017 on RDS Cluster Edition only support the Virtual Private Cloud (VPC) network type. Therefore, they only support internal endpoints of the VPC network type. You can only select VPC for this parameter.
    • Internet address: used to access the RDS instance from the Internet. The Internet is prone to fluctuations. Therefore, we recommend that you use an internal endpoint to connect to the RDS instance.
    Read Weight Distribution The read weight of each read-only instance in your database system. A higher read weight indicates more read requests to process. 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 the 1:2:2 ratio.
    • Automatic Distribution: Your database system assigns a read weight to each read-only instance based on the instance specifications. After you create a read-only instance, your database system automatically assigns a read weight to the read-only instance. For more information, see Rules of weight distribution by the system.
    • Customized Distribution: You must manually specify the read weight of each read-only instance. Valid values: 0 to 10000. After you create a read-only instance, the default value of the read weight is 0. You must manually specify the read weight of the read-only instance.
  7. Click OK.

What to do next

  • You can add the endpoint of the primary instance and the read-only routing endpoint to the configuration data of your application. After you do so, the system distributes write requests to the primary instance and read requests to the read-only routing endpoint. The read-only routing endpoint then distributes the read requests to the read-only instances based on the specified read weights.
  • You can view the ID, running status, read weight of each read-only instance. Additionally, you can click Manage in the Actions column for a read-only instance to manage the instance.