tencent cloud

DokumentasiTDSQL-C for MySQL

Access Mode

Unduh
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-11-10 17:06:03
Diterjemahkan oleh AI
This document describes the access mode capabilities of the database proxy for TDSQL-C for MySQL.

Prerequisites

Learn the basic concepts: gateway, database proxy address (Proxy VIP), database proxy node, primary/secondary instance, and AZ.
Note:
When an application accesses a TDSQL-C for MySQL cluster, the complete access path is: application → database proxy address (Proxy VIP) → gateway → proxy node → cluster primary instance.
The gateway is a component automatically created and fixed by the system after you purchase a TDSQL-C for MySQL cluster. Its AZ is the same as the AZ of the primary instance in the cluster and cannot be modified after creation. The access mode of the database proxy is essentially determined by the gateway, which decides how to distribute connections from the database proxy address to database proxy nodes in specific AZs.
Therefore, the "access path" mentioned below refers to the path between the gateway and the database proxy node, as well as the path between the database proxy node and the primary instance.

Basic Concepts

To help you understand the access modes, the following briefly describes several core terms used in this document.
Term
Description
Gateway
A component automatically created and fixed by the system after a user purchases a TDSQL-C for MySQL cluster. It serves as the traffic entry between the database proxy address and the database proxy nodes. Its AZ is the AZ where the primary instance in the cluster resides, and it cannot be modified after creation.
Database proxy address (Proxy VIP)
A virtual IP address used by applications to access the database proxy. Applications only need to connect to this address, and specific node routing and load distribution are handled by the gateway and database proxy nodes.
Proxy node
The actual compute node of the database proxy, responsible for accepting connections, performing connection reuse, and forwarding. Proxy nodes can be deployed across multiple AZs. In different access modes, the gateway distributes connections to the corresponding proxy nodes according to rules.
Primary instance / Standby instance
In the architecture of a TDSQL-C for MySQL cluster, the primary instance provides read and write services externally, and the secondary instance synchronizes data from the primary instance in real time and serves as a hot standby for disaster recovery. When the primary instance fails, a primary-secondary switch is triggered, and the secondary instance is promoted to the new primary instance to continue providing services.
AZ
A physical data center area within the same region with independent power and network. Different AZs are interconnected through a low-latency private network, and cross-AZ deployment can achieve disaster recovery and high availability.

Introduction

The access mode primarily controls the database proxy node path that a connection takes after passing through the gateway when an application (client) accesses a cluster through the database proxy address. There are two access modes: Balanced Distribution and Nearby Access. The following describes the rules, advantages and disadvantages, and behavior after a primary-secondary switch for each mode.

Balanced Distribution


Rule: In balanced distribution mode, an application accesses the cluster through the database proxy address. After the request passes through the gateway, it is evenly distributed to database proxy nodes in each AZ, and these proxy nodes then access the primary instance in the cluster. If the database proxy has nodes in multiple AZs, all connections are evenly distributed to the database proxy nodes across all AZs.
Advantages: Traffic is evenly distributed, so no single node is overloaded.
Disadvantages: If proxy nodes are deployed in different AZs, requests may experience high latency due to a long access path. Here, a "long access path" mainly means that the gateway and the database proxy node are in different AZs, which may result in relatively higher latency.

Primary-Standby Switchover in Balanced Distribution Mode


After a primary-secondary switch occurs in the cluster, the original primary instance and secondary instance are switched. If the original primary and secondary instances are deployed across AZs, the AZ of the original primary instance is updated to the AZ of the original secondary instance after the switch (for example, from AZ1 to AZ2), but the AZ of the gateway remains unchanged (still AZ1, the AZ of the original primary instance). At this point, the gateway still evenly distributes connections to the database proxy nodes in each AZ. Cross-AZ access may further occur between the proxy nodes and the primary instance, which increases the overall link latency, but the load on each proxy node remains balanced.

Nearby Access


Rule: In nearest access mode, an application accesses the cluster through the database proxy address. After the request passes through the gateway, all connections are distributed to the database proxy nodes in the same AZ as the gateway, and these proxy nodes then access the primary instance in the cluster. If the database proxy has nodes in multiple AZs, the gateway only selects proxy nodes in the same AZ as itself for connection and does not distribute connections across AZs.
Advantages: Low access latency and high speed, because connections always land on database proxy nodes in the same AZ as the gateway, avoiding cross-AZ network overhead between the gateway and proxy nodes.
Disadvantages: If a primary-secondary switch occurs in the cluster and the primary and secondary instances are in different AZs, the AZ of the gateway may be inconsistent with the AZ of the new primary instance after the switch. In this case, although the path from the gateway to the proxy node remains within the same AZ (low latency), the proxy node needs to access the new primary instance across AZs, resulting in higher latency.
Note:
If a cluster uses cross-AZ deployment and the database proxy access mode feature, selecting the nearest access mode may increase the access latency through the database proxy connection address when a primary-secondary switch occurs. It is recommended that clusters deployed in a single AZ use the nearest access mode.

Primary-Standby Switchover in Nearby Access Mode


After a primary-secondary switch occurs in the cluster, the original primary instance and secondary instance are switched. If the original primary and secondary instances are deployed across AZs, the AZ of the original primary instance is updated to the AZ of the original secondary instance after the switch (for example, from AZ1 to AZ2), but the AZ of the gateway remains unchanged (still AZ1). In nearest access mode, the gateway still distributes connections to the database proxy nodes in the same AZ as itself (AZ1). Because the AZ of the new primary instance is now AZ2, the proxy nodes need to access the primary instance across AZs, which increases latency. If the number of proxy nodes in AZ1 is limited and connections are concentrated, the proxy nodes in a single AZ may become overloaded, causing request slowdowns.

Modifying the Access Mode

When modifying an access policy, you can also modify the access mode. For detailed steps, refer to View and Modify Access Policy.

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan