This topic describes how to add an access address and perform other operations related to an access address.
Principle
ApsaraDB for OceanBase provides a network proxy layer between your database and applications. You can add a read-only address or read/write splitting address in the proxy layer to fully use the multi-replica capabilities of ApsaraDB for OceanBase, thereby improving the execution efficiency of your business system.
In ApsaraDB for OceanBase, read/write splitting means that the read and write operations are respectively processed by different nodes to improve the read/write performance and availability of the database. Write operations that usually involve data modifications and updates are performed on the primary node. This ensures data consistency and reliability and avoids data corruption and losses, thereby improving the security and stability of the database. Read operations that only access data replicas are distributed to multiple standby nodes to implement parallel processing and load balancing. This reduces the load and response time of the database, thereby improving user experience and satisfaction. For more information, see Overview.
Concepts
Primary address: It supports data reads and writes with strong consistency. By default, data is read by using the primary address. When a tenant is created, the primary address is automatically created. By default, the primary address proxy is deployed in a primary zone.
Access address: It can be a read-only address or a read/write splitting address.
Read-only address: It supports only read operations. Read requests are sent to a follower of the full-featured replica to ensure final data consistency.
Read/Write splitting address: It supports both read and write operations. Write requests are sent to the leader of the full-featured replica, and read requests beyond the transaction are sent to followers to reduce load on the leader, ensuring final data consistency.
Direct connection address: It supports both read and write operations. By default, requests are directly forwarded to the leader.
NoteGenerally, the data accessed by using a read-only address lags less than 1s behind the data accessed by using the corresponding primary address.
We recommend that you use a primary address, read-only address, or read/write splitting address in a production environment.
At present, the direct connection address service is available only to users on the allowlist. To enable this service, contact ApsaraDB for OceanBase Technical Support.
Limitations
The limitations on access addresses are as follows:
You cannot add an access address for a tenant in a standby instance.
In single-IDC deployment mode, only one primary address is supported at the proxy layer, and no access address can be added.
In dual-IDC deployment mode, only one primary address is supported at the proxy layer, and only one read-only or read/write splitting address can be added.
In multi-IDC deployment mode, only one primary address is supported at the proxy layer, and at most two read-only or read/write splitting addresses can be added. If you need more addresses, contact OceanBase Technical Support to apply for proxy resources of higher specifications.
The limitations on direct connection addresses are as follows:
Direct connection addresses can be created only for a tenant of ApsaraDB for OceanBase V4.2.1.2 or later with only one resource unit.
At present, a direct connection address can be used for private network access.
The version limitations on read/write splitting addresses are as follows:
For a cluster of OceanBase Database V3.x, you can enable read/write splitting addresses only if the version of OceanBase Database Proxy (ODP) ranges from V3.2.9 to V4.0.
For a cluster of OceanBase Database V4.x, you can enable read/write splitting addresses only if the version of ODP is V4.1 or later.
Procedure
Log in to the ApsaraDB for OceanBase console.
In the left-side navigation pane, click Instances.
In the instance list, click the name of the target cluster instance to go to the Cluster Instance Workspace page.
In the tenant list, click the name of the target tenant to go to the Tenant Workspace page.
Click the More icon in the upper right corner, and select Add Access Address.
NoteIf the number of access addresses for cluster replicas reaches the specified threshold, the Add Access Address button is unavailable.
Specify the type and zone of the address, etc. and click OK.
Parameter
Description
Address Type
The type of the address to be added. Valid values:
Read-only
Read/Write Splitting
Direct Connect
NoteFor a tenant in a Standard Edition (Key-Value) instance, you can add only one read-only address.
Zone for Access URL
The zone of the address. To add a read-only address, specify the zone where the address resides. To add a read/write splitting address, specify the zone where the data accessed by read requests resides.
If you add a read-only or read/write splitting address, the address proxy and the accessed data are in the same zone, namely, the specified zone.
If you add a direct connection address, the address must be in the primary zone.
Select Replica for Read Traffic Access
Based on Replica Type: Traffic is forwarded to your selected type of replica. If you select multiple replicas of this type, traffic is distributed based on the set load balancing policy.
Based on Replica: Traffic is forwarded to your selected replica.
NoteIf you select the Based on Replica method, you must upgrade the ODP version to V4.3.1 or later. To upgrade ODP, submit a ticket to OceanBase Technical Support.
Load Balancing Strategy
Prioritize Replica in the Same Zone: Preferentially accesses replicas in the same zone as ODP.
NoteThis value is only applicable when you select the Based on Replica Type method for the Select Replica for Read Traffic Access parameter.
Automatic Balancing: Automatically balances traffic among the selected replicas based on the current load.
Custom Weight: You can customize the access traffic weight of the selected replica.
NoteThis value is only applicable when you select the Based on Replica method for the Select Replica for Read Traffic Access parameter.
Disaster Recovery Strategy
When you set the traffic by replica type, read traffic is automatically forwarded to the primary replica if your selected type of replica is not available.
When you set the traffic by replica, traffic is forwarded to your selected disaster recovery replicas if the specified replicas are not available. Traffic is automatically balanced among multiple replicas based on the current load.
NoteCurrently, it is not allowed to forward traffic from a read-only column store replica to other types of replicas or vice versa. Specifically, the disaster recovery strategy has the following limitations:
When you select the Based on Replica Type method for the Select Replica for Read Traffic Access parameter and select a Read-only Column Store Replica, the disaster recovery strategy is not available.
When you select the Based on Replica method for the Select Replica for Read Traffic Access parameter and select a Read-only Column Store Replica, you can only select another read-only column store replica as its disaster recovery replica. When you select a replica other than a read-only column store replica for read traffic, you cannot select a read-only column store replica as its disaster recovery replica.
Primary Endpoint VPC
The VPC of ODP.
ImportantSelect an ODP VPC rather than a cluster or tenant VPC.
If no suitable VPC is available, create a VPC as prompted. For more information, see What is a VPC?.
Primary Endpoint vSwitch
The vSwitch of ODP. If no vSwitch is available, go to the VPC console and create a vSwitch.
Consistency Level
The default value is Eventual Consistency. Data replication latency exists between a read-only zone and a primary zone. This may cause a time difference in the query result between the read-only zone and the primary zone. The query result is determined by the replication latency. However, the data is eventually consistent.
High Availability
The ODP service is deployed with a high-availability (HA) architecture that provides disaster recovery capabilities. In dual-IDC deployment, you can specify a zone as the primary zone when creating a proxy address. By default, the other zone serves as the standby zone. If the primary zone or the primary node of the proxy address fails, the system switches to the standby zone.
Load Balancing Policy
The default value is Automatic scheduling based on load. The system monitors the load of servers in real time and automatically routes new requests to servers with lower load to prevent any node from becoming overloaded. For more information, see Load balancing.
Read Latency Threshold
The read latency threshold of the replica. If the read latency of the replica is greater than 5s, OceanBase Database reads the replica with latency less than 5s.
Related operations
Enable public IP addresses
ApsaraDB for OceanBase allows you to enable public IP addresses for primary addresses of tenant instances and serverless instances. The following procedure takes a tenant instance as an example:
Log on to the ApsaraDB for OceanBase console.
In the left-side navigation pane, click Instances.
In the instance list, click the name of the target cluster instance to go to the Cluster Instance Workspace page.
In the left-side navigation pane, click Tenant Management.
In the tenant list, click the name of the target tenant to go to the Tenant Workspace page.
In the Deployment Diagram section, click Activate on the primary address card.
In the dialog box that appears, click OK.
After the public IP address is enabled, you need to add it to the allowlist. For more information, see Create an allowlist.
Delete an access address
Log on to the ApsaraDB for OceanBase console.
In the left-side navigation pane, click Instances.
On the Instances page, click the name of the target cluster instance to go to the Cluster Instance Workspace page.
In the left-side navigation pane, click Tenant Management. The Tenant Management page appears.
In the tenant list, click the name of the target tenant to go to the Tenant Workspace page.
Hover over the target address card in the Deployment Diagram section.
Click in the upper-right corner of the card.
NoteAfter an access address is deleted, the related service becomes unavailable. Before you delete an access address, make sure that all access requests to the address are stopped.
View proxy address information
After you add an access address or direct connection address, you can view the address information in the deployment diagram section of the tenant workspace.
You can hover over the card of a primary address, access address, or direct connection address to view the complete private address. In the upper-right corner of the card, you can click the Set icon to edit the access address or direct connection address, and click the Delete icon to delete the address.
You can click the Copy icon next to a private address to copy the address.
You can click the Edit icon next to Maximum Connections to modify the maximum number of connections to the corresponding address.
You can click Activate to enable a public address for the private address of the primary address.