All Products
Search
Document Center

ApsaraDB RDS:Enable the database proxy feature

Last Updated:Jan 30, 2024

The database proxy feature of ApsaraDB RDS for MySQL supports capabilities such as read/write splitting, persistent connections, and SSL encryption. This helps reduce the load on your primary ApsaraDB RDS for MySQL instance and improve the availability and security of the RDS instance. This topic describes how to enable the database proxy feature for an RDS instance in the ApsaraDB RDS console and by calling related API operations. This topic also describes the method for calculating the recommended specification of database proxies.

Prerequisites

Your RDS instance is a primary RDS instance and meets the following requirements.

  • Version requirements:

    Major engine version

    RDS edition

    Minor engine version

    MySQL 8.0

    RDS Enterprise Edition

    20191204 or later

    RDS High-availability Edition

    20190915 or later

    RDS Cluster Edition

    No requirements

    MySQL 5.7

    RDS Enterprise Edition

    20191128 or later

    RDS High-availability Edition

    20190925 or later

    RDS Cluster Edition

    No requirements

    MySQL 5.6

    RDS High-availability Edition

    20200229 or later

  • Region requirements: The RDS instance for which you want to enable the database proxy feature does not reside in Hangzhou Zone C or Hangzhou Zone D.

Note

You can go to the Basic Information page of your RDS instance to view the preceding information. In the Configuration Information section, you can check whether Upgrade Kernel Version is displayed. If Upgrade Kernel Version is displayed, click Upgrade Kernel Version to view the minor engine version of the RDS instance. If Upgrade Kernel Version is not displayed, your RDS instance runs the latest minor engine version. For more information, see Update the minor engine version.

Billing rules

  • General-purpose database proxies are provided free of charge.

  • Dedicated database proxies are charged based on the pay-as-you-go billing method. For more information, see Billing rules for database proxies.

Limits

  • If you enable the database proxy feature for your RDS instance, your RDS instance does not support compression protocols.

  • If you enable the database proxy feature for your RDS instance, your RDS instance does not support vSwitch changes.

Usage notes

  • If you use RDS Cluster Edition, you can use the primary and secondary nodes in your RDS cluster to implement read/write splitting. An RDS instance that runs RDS Cluster Edition is referred as an RDS cluster.

  • After the database proxy feature is enabled, we recommend that you do not migrate the primary RDS instance across zones. If you migrate the primary RDS instance across zones, the primary RDS instance and its database proxies are in different zones. This increases access latency and slows down responses.

    Note

    If a primary/secondary switchover is triggered due to service failures, the primary RDS instance and its database proxies are in different zones. To reduce access latency, you can perform a primary/secondary switchover to make sure that the primary RDS instance and its database proxies are in the same zone. For more information, see Switch workloads over between primary and secondary ApsaraDB RDS for MySQL instances.

Procedure

Note

This section describes how to enable the database proxy feature for your RDS instance in the ApsaraDB RDS console. You can also enable the database proxy feature when you create a read-only RDS instance for your RDS instance. For more information, see Create a read-only ApsaraDB RDS for MySQL instance.

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

  2. In the left-side navigation pane, click Database Proxy.

  3. Find the required database proxy type and click Enable Now.

    • General-purpose: General-purpose database proxies are provided free of charge. When you enable a general-purpose database proxy, the system automatically uses the recommended proxy specification. After the database proxy is enabled, you can change the proxy specification.

    • Dedicated: Dedicated database proxies are charged based on the pay-as-you-go billing method. When you enable a dedicated database proxy, you can configure the proxy specification.

      Note

      The recommended specification of database proxies is calculated by using the following formula:

      Recommended specification of database proxies = Recommended number of database proxies × Unit specification of a database proxy The unit specification of a database proxy is fixed as 2 CPU cores.

      The highest specification of a general-purpose database proxy is 16 CPU cores. The highest specification of a dedicated database proxy is 32 CPU cores. The following table describes how the recommended number of database proxies is calculated.

      Database proxy type

      RDS instance that runs RDS High-availability Edition

      RDS instance that runs RDS Cluster Edition

      Recommended number of general-purpose database proxies

      (Number of CPU cores of the primary RDS instance + Number of CPU cores of all read-only RDS instances that belong to the primary RDS instance)/4. The result is rounded up.

      (Number of CPU cores of the primary node + Number of CPU cores of all secondary nodes that belong to the primary node)/4. The result is rounded up.

      Recommended number of dedicated database proxies

      (Number of CPU cores of the primary RDS instance + Number of CPU cores of all read-only RDS instances that belong to the primary RDS instance)/8. The result is rounded up.

      (Number of CPU cores of the primary node + Number of CPU cores of all secondary nodes that belong to the primary node)/8. The result is rounded up.

      For example, if your primary RDS instance that runs RDS High-availability Edition has 8 CPU cores and its read-only RDS instance has 4 CPU cores, the recommended number of database proxies is 2. The number is obtained based on the following calculation: (8 + 4)/8 = 1.5. The result 1.5 is rounded up to 2. The recommended specification of database proxies is 4 CPU cores. The number is obtained based on the following calculation: 2 × 2 = 4.

  4. Click OK.

    After you enable the database proxy feature, you can go to the Database Proxy page to view the basic information and connection information about the database proxy.

    Section

    Parameter

    Description

    Basic Information

    Primary Instance

    The ID of the RDS instance.

    Proxy Instance Status

    The status of the database proxy instance.

    Proxy Type

    The database proxy type. The value can be General-purpose and Dedicated. For more information about the differences between general-purpose database proxies and dedicated database proxies, see What are database proxies?

    Zone

    The zone of the database proxy instance. By default, the zone of the database proxy instance is the same as that of the primary RDS instance.

    Proxy Specifications

    The specification of the database proxy.

    The following calculation describes the relationship between the specification of database proxies and the number of database proxies: Specification of database proxies = Unit specification of a database proxy × Number of database proxies. In this calculation, the unit specification of a database proxy is fixed as 2 CPU cores. For example, if the number of database proxies is 3, the specification of the database proxies is 6 CPU cores. The value is obtained based on the following calculation: 2 x 3 = 6.

    Proxy Version

    The database proxy version.

    Connection Information

    Proxy Endpoint (Terminal) ID

    The ID of the database proxy endpoint. You can configure different connection settings for each database proxy endpoint.

    Note
    • Each RDS instance supports up to seven database proxy endpoints. You can apply for one internal endpoint and one public endpoint for each database proxy endpoint.

    • If you enable a database proxy for your RDS instance, the system assign a database proxy endpoint with default connection settings. You can use the database proxy endpoint to connect to the RDS instance. For more information about how to modify the connection settings, see Configure the connection settings for a database proxy endpoint.

    • You can move the pointer over the ID of the database proxy endpoint to view the connection settings of the database proxy endpoint. The connection settings include Read/Write Attributes and the information in the Read Weight Information section.

    Read/Write Attributes

    The read and write attributes of the database proxy. The value can be Read/Write and Read-only.

    For more information, see Configure the read and write attributes and the read weight of the database proxy.

    Internal Endpoint/Port

    The internal endpoint of the database proxy endpoint and the port that is associated with the database proxy endpoint.

    You can use this endpoint to connect to the RDS instance over an internal network and use the database proxy feature.

    Note

    Public Endpoint/Port

    The public endpoint of the database proxy endpoint and the port that is associated with the database proxy endpoint.

    You can use this endpoint to connect to the RDS instance over the Internet and use the database proxy feature.

    Note
    • The database proxy provides an internal endpoint by default. You can apply for a public endpoint.

    • After you apply for a public endpoint, you can click the image.png icon to the right of the endpoint to modify the prefix of the endpoint and the port that is associated with the endpoint. For more information, see Manage the database proxy endpoints.

Note

If the RDS instance resides in the classic network, you must select a virtual private cloud (VPC) and a vSwitch for the RDS instance to create a database proxy endpoint. We recommend that you select the vSwitch that resides in the same zone as the primary RDS instance. After you enable the database proxy feature, you cannot switch the VPC and vSwitch. For more information, see [EOS/Discontinuation] Internal endpoints of the classic network type can no longer be created for database proxies in ApsaraDB RDS for MySQL, [EOS/Discontinuation] ApsaraDB RDS for MySQL instances of the classic network type are no longer available for purchase, Create and manage a VPC, and Manage database proxy endpoints.

Related operations

Operation

Description

ModifyDBProxy

Modifies a database proxy. When you enable the database proxy feature for an RDS instance, you must set the ConfigDBProxyService parameter to Startup. You can configure other parameters based on your business requirements.

DescribeDBProxy

Queries the database proxy details of an RDS instance.