The database proxy feature of ApsaraDB RDS for PostgreSQL provides advanced capabilities such as read/write splitting. This topic describes how to enable and configure the database proxy feature for an ApsaraDB RDS for PostgreSQL instance.
Prerequisites
- The major engine version of the instance is PostgreSQL 10, PostgreSQL 11, PostgreSQL 12, PostgreSQL 13, or PostgreSQL 14.
- The instance uses standard SSDs or enhanced SSDs (ESSDs).
- The instance runs RDS High-availability Edition.
- The instance is a primary RDS instance.
- The database proxy feature of ApsaraDB RDS for PostgreSQL is rolled out in phases.
The feature is available in the following regions and zones:
- China (Hong Kong): Hongkong Zone B.
- China (Hangzhou): Hangzhou Zone G, Hangzhou Zone H, Hangzhou Zone I, and Hangzhou Zone J.
- China (Beijing): Beijing Zone F, Beijing Zone G, Beijing Zone H, and Beijing Zone I.
- China (Zhangjiakou): Zhangjiakou Zone A, Zhangjiakou Zone B, and Zhangjiakou Zone C.
- China (Shanghai): Shanghai Zone B, Shanghai Zone E, Shanghai Zone F, and Shanghai Zone G.
- China (Shenzhen): Shenzhen Zone D and Shenzhen Zone E.
- Indonesia (Jakarta): Jakarta Zone A.
- Singapore (Singapore): Singapore Zone A, Singapore Zone B, and Singapore Zone C.
Billing
For more information, see Billing rules for the database proxy of an ApsaraDB RDS for PostgreSQL instance.
Precautions
- 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 proxy instances are in different zones. This increases access latency and slows down responses.
- A read-only RDS instance is created for your RDS instance. If no read-only RDS instances exist, you can enable the database proxy feature but cannot configure proxy terminals for your RDS instance. For more information, see Create a read-only ApsaraDB RDS for PostgreSQL instance.
Procedure
Step 1: Enable the database proxy feature
Step 2: Configure a proxy terminal
Before you can use the advanced capabilities that are provided by the database proxy feature, you must configure a proxy terminal for your RDS instance.
After you configure a proxy terminal, you must add the specified endpoint of the proxy terminal to your application. Then, ApsaraDB RDS can route write requests to the primary RDS instance and read requests to the read-only RDS instances based on the read weights of these instances.
Processing logic based on the read and write attributes
Read and write attributes | Method to specify read weights | Weight of a primary RDS instance | Normal case | After the last read-only RDS instance is deleted | After all read-only RDS instances are faulty |
---|---|---|---|---|---|
Read-only | Automatic or Custom | You cannot specify a read weight for your primary RDS instance. |
|
|
|
Read and write | Automatic | A weight greater than 0
For more information, see Default read weights. |
|
|
|
Custom | A weight greater than 0 |
|
|
|
|
A weight equal to 0 |
|
|
|
Related operations
Operation | Description |
---|---|
ModifyDBProxy | Enables or disables the database proxy feature. |
DescribeDBProxy | Queries the details of a database proxy. |
ModifyDBProxyEndpoint | Configures a database proxy terminal. |