This topic describes how to add an access address and perform other operations related to an access address.
Principles
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 Database proxy 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.
Add an access address
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 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 and click OK.
Parameter
Description
Address Type
The type of the address to be added. Valid values:
Read-only
Read/Write Splitting
Direct Connection
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.
Replica Type
The type of replicas that you want to add.
VPC
By default, the virtual private cloud (VPC) ID of the tenant is displayed. We recommend that you use the VPC where your business or application resides to effectively reduce the access latency.
If no suitable VPC is available, create a VPC as prompted. For more information, see What is a VPC.
vSwitch
By default, the vSwitch ID of the tenant is displayed. You can select another vSwitch ID as needed or create a vSwitch and select its ID in the console.
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 default value is Primary/Standby High-Availability Mode. When the read-only zone fails, the system switches to another zone.
Load Balancing Strategy
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 default value is 5s. You can specify a read latency threshold to monitor and manage the response efficiency of the database, thereby ensuring the timeliness of data access.
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 Enable 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.
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. 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 Enable to enable a public address for the private address of the primary address.