tencent cloud

DocumentaçãoTDSQL-C for MySQL

Setting a Single or Multiple Connection Addresses

Download
Modo Foco
Tamanho da Fonte
Última atualização: 2026-01-29 17:54:30
This document describes how to set a single or multiple database proxy connection addresses via the TDSQL-C for MySQL console.
The database proxy access address is independent of the original database access address. Requests proxied at the proxy address are all relayed through the proxy cluster to access the source and replica nodes of the database. Read/Write requests are separated, so that read requests are forwarded to read-only instances, which lowers the load of the source database.

Prerequisite

You have enabled the database proxy. For more information, see Enabling Database Proxy.

Setting a Single Database Proxy Connection Address

After the database proxy is enabled, TDSQL-C for MySQL provides a database proxy connection address by default. You can configure the policy for it and mount it to read-only instances.
1. Log in to the TDSQL-C for MySQL console, select a cluster with the proxy enabled in the cluster list, and click the Cluster ID to enter the cluster management page.
2. Open the topology in Cluster Management > Cluster Details, hover over the database proxy area, and click Details to go to the database proxy management page. Alternatively, click the Database Proxy tab on the cluster management page to go to the Database Proxy management page.
3. Find the target access address on the connection address page and click Adjust Configuration in the operation column.

4. Complete the configurations in the pop-up window and click OK.
5. Step 1: Configuraion Policy.

Parameter
Description
Read/Write Attribute
Select the read-write attribute of the proxy access address, which can be read/write separation or read-only. If read/write separation is selected, the read/write separation feature will be enabled automatically.
Access Mode
Select Balanced distribution or Nearby access to set the connection link from the client to the database proxy. For details, see Access Mode.
Consistency Settings
If read/write separation is selected, three consistency levels are provided: eventual consistency, session consistency, and global consistency. They can meet your consistency requirements in different scenarios. For details, see Consistency Level.
Note:
Changes to the consistency level take effect only for new connections. If you need the parameter to take effect immediately through resetting the connection, you can use the load rebalancing feature or restart the instance.
Connection Pool Status
The connection pool feature is mainly used to reduce the instance load caused by the frequent establishment of new connections in non-persistent connection services. If you enable this feature, you can select a supported connection pool type. Currently, only session-level connection pools are supported by default.
Connection Pool Threshold
Set a connection pool threshold in the range of 0 to 300 seconds.
Transaction Split
Determine whether to enable this feature. Once it is enabled, reads and writes in one transaction are split and executed on different instances. Read requests are forwarded to read-only instances to reduce the load on the primary instance.
Failover (Read/write separation selected)
Determine whether to enable this feature. Once it is enabled, the connection address will be routed to the primary instance when the database proxy encounters faults.
Apply to Newly Added RO Instances
Determine whether to enable this feature. Once it is enabled, newly purchased read-only instances or read-only analysis engines will be automatically added to the database proxy.
If the read weight is automatically assigned by the system, a weight is assigned to newly purchased read-only instances according to the specification.
If the read weight is customized, the weight of newly purchased read-only instances is 0 by default when they are added. You can click Adjust Configuration on the Database Proxy > Connection Address page to modify the weight.
Step 2: Configure the weight.

Parameter
Description
Assign Read Weight
The database proxy needs to distribute read requests to different instances. By assigning different read weights to each instance, the database proxy can determine the target instance for forwarding requests based on the weight. The weight can be automatically assigned by the system or customized.
If the weight is customized, you can configure the weight for different instances. The descriptions of the enabling status and weight during weight assignment are as follows:
Enable: If the status is Enabled, the corresponding instance will be assigned a weight for connection. If the status is Disabled, no weight will be assigned to the corresponding instance for connection.
Weight: Weight range: 0-100. 0 means that the corresponding instance will be assigned a weight for connection, but the weight is the lowest. The larger the value, the higher the weight, and the more read requests. After the read weights are assigned, read requests will be routed to the corresponding instances in proportion. For example, if the read weights of Instance 1, Instance 2, and Instance 3 are set to 3, 2, and 1, read requests from the database proxy connection address will be routed to Instance 1, Instance 2, and Instance 3 in the ratio of 3:2:1.
Note:
The weight here is for read requests (non-transactional).
The read-only analysis engine does not support weight modification. It only supports using the hint syntax of /*to server instance ID*/ to forcibly specify the forwarding destination.

Setting Multiple Database Proxy Connection Addresses

Note:
The maximum number of database proxy connection addresses is 7.
A connection address is created by default when a database proxy is enabled.
1. Log in to the TDSQL-C for MySQL console, select a cluster with the proxy enabled in the cluster list, and click the Cluster ID to enter the cluster management page.
2. Open the topology in Cluster Management > Cluster Details, hover over the database proxy area, and click Details to go to the database proxy management page. Alternatively, click the Database Proxy tab on the cluster management page to go to the database proxy management page.
3. Click Add Access Address next to Connection Address on the database proxy management page.

4. Complete the following configurations in the pop-up window and click OK.
5. Step 1: Network Configuration

Parameter
Description
Network
Select a network for the database proxy. Only VPCs are supported. You can choose to automatically assign an IP address or manually specify it.
Security Group
The default security group is the same as that of the primary instance. You can also select an existing security group or create one as needed. Multiple security groups can be selected.
Note:
You need to configure the security policy and allow the private network access port (3306 currently) to access the database proxy. For details, see Creating and Managing TencentDB Security Groups.
Remarks
Optional. Leave remarks for the database proxy connection address to be added.
Step 2: Configuration Policy.

Parameter
Description
Read-Write Attribute
Select the read-write attribute of the proxy access address, which can be read/write separation or read-only. If read/write separation is selected, the read/write separation feature will be enabled automatically.
Access Mode
Select Balanced distribution or Nearby access to set the connection link from the client to the database proxy. For details, see Access Mode.
Consistency Settings
If read/write separation is selected, three consistency levels are provided: eventual consistency, session consistency, and global consistency. They can meet your consistency requirements in different scenarios. For details, see Consistency Level.
Note:
Changes to the consistency level take effect only for new connections. If you need the parameter to take effect immediately through resetting the connection, you can use the load rebalancing feature or restart the instance.
Connection Pool Status
The connection pool feature is mainly used to reduce the instance load caused by the frequent establishment of new connections in non-persistent connection services. If you enable this feature, you can select a supported connection pool type. Currently, only session-level connection pools are supported by default.
Connection Pool Threshold
Set a connection pool threshold in the range of 0 to 300 seconds.
Transaction Split
Determine whether to enable this feature. Once it is enabled, reads and writes in one transaction are split and executed on different instances. Read requests are forwarded to read-only instances to reduce the load on the primary instance.
Failover (Read/write separation selected)
Determine whether to enable this feature. Once it is enabled, the connection address will be routed to the primary instance when the database proxy encounters faults.
Apply to Newly Added RO Instances
Determine whether to enable this feature. Once it is enabled, newly purchased read-only instances will be automatically added to the database proxy.
If the read weight is automatically assigned by the system, a weight is assigned to newly purchased read-only instances according to the specification.
If the read weight is customized, the weight of newly purchased read-only instances is 0 by default when they are added. You can click Adjust Configuration on the Database Proxy > Connection Address page to modify the weight.
Step 3: Configure Weight.

Parameter
Description
Assign Read Weight
The database proxy needs to distribute read requests to different instances. By assigning different read weights to each instance, the database proxy can determine the target instance for forwarding requests based on the weight. The weight can be automatically assigned by the system or customized.
If the weight is customized, you can configure the weight for different instances. The descriptions of the enabling status and weight during weight assignment are as follows:
Enabling Status: If the status is Enabled, the corresponding instance will be assigned a weight for connection. If the status is Disabled, no weight will be assigned to the corresponding instance for connection.
Weight: Weight range: 0-100. 0 means that the corresponding instance will be assigned a weight for connection, but the weight is the lowest. The larger the value, the higher the weight, and the more read requests. After the read weights are assigned, read requests will be routed to the corresponding instances in proportion. For example, if the read weights of Instance 1, Instance 2, and Instance 3 are set to 3, 2, and 1, read requests from the database proxy connection address will be routed to Instance 1, Instance 2, and Instance 3 in the ratio of 3:2:1.
Note:
The weight here is for read requests (non-transactional).
The read-only analysis engine does not support weight modification. It only supports using the hint syntax of /*to server instance ID*/ to forcibly specify the forwarding destination.

Related APIs

API
Description
This API (CreateProxyEndPoint) is used to create a database proxy connection point.

Ajuda e Suporte

Esta página foi útil?

comentários