Overview
Call CreateReadwritePrivatelink to create a private read/write splitting endpoint for a tenant in the specified OceanBase Cloud instance. The endpoint routes read and write requests to different database nodes to improve concurrency and overall database performance.
API details
Constraints
The caller must have an AccessKey for accessing the multi-cloud API. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
POST /api/v2/instances/{instanceId}/tenants/{tenantId}/privatelink/readwrite
Request parameters
Path
Name |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| instanceId | string | Yes | The ID of the ApsaraDB for OceanBase cluster instance. | obcluster-***** |
| tenantId | string | Yes | The ID of the tenant. | t4louaeei**** |
Query
Name |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| requestId | string | Yes | The ID of the request. This parameter is used for tracing. | dc302d76-66b5-48d8-ab53-a035******** |
Body
Parameter |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| zoneIdList | Array[String] | No | Physical zone IDs for the tenant. If the account does not support custom proxy configurations, this list is required and must contain at least one zone. Optional when proxySetting is specified. | See the zoneIdList request example. |
| userAccount | String | Yes | Cloud account ID to add to the Private Link service allowlist. | <cloud account ID> |
| trafficStrategy | string | Yes | The traffic strategy. | REPLICA_TYPE |
| replicaParams | string | Yes | Replica configuration. When routing by replica type, specify a replica type that the tenant has. | [{"Value":"FULL"}] |
| disasterRecoveryReplicaParams | string | No | The disaster recovery replica parameters. | — |
| balancedStrategy | string | No | The load balancing strategy. | AUTO_BALANCE |
| disasterRecoveryStrategy | string | No | The disaster recovery strategy. | NO |
| serviceType | string | Yes | The address type. | OBPROXY_READWRITE |
| proxySetting | Object | No | Database proxy configuration for the private read/write splitting address. Required for Alibaba Cloud and AWS instances if the account supports custom proxy configurations. | See the proxySetting request example. |
proxySetting object fields
Parameter |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| mode | String | Yes | Database proxy specification type. Valid values:
|
k8s_shared |
| deploymentArchitecture | String | Yes | Database proxy deployment architecture. Valid values:
NoteThree-zone deployment is available in supported Alibaba Cloud and AWS regions. Both three-zone architectures require a dedicated proxy cluster with the 2.0 architecture and an OceanBase instance deployed across three zones. |
single_az_deployment |
| zone | Array[String] | Yes | Physical zone IDs for the primary nodes. Specify at least one zone available to the target instance or tenant. The number of zones depends on deploymentArchitecture. |
See the zone request example. |
| slaveZone | Array[String] | Yes | Physical zone IDs for the standby nodes. Specify standby zones for an active-standby deployment. For other architectures, specify []. This field does not accept null. |
See the slaveZone request example. |
| nodeCpu | Number | Yes | CPU cores per proxy node. The value must be greater than 0. Creating or resizing a shared or Serverless proxy requires at least 1 core per node. | 1 |
Response parameters
Parameter |
Type |
Description |
|---|---|---|
| code | string | The return code. |
| message | string | The return message. |
| data | object | The returned data object. |
| data.resourceId | string | The resource ID of the created private read/write split endpoint. |
| data.status | string | The status of the resource creation. |
| data.requestId | string | The ID of the request. |
Examples
Request example
Create a private read/write splitting address with a specified proxy configuration and a full-featured replica (
FULL).curl --digest -X POST \ 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/privatelink/readwrite?requestId={requestId}' \ -H 'Content-Type: application/json' \ -u '<AccessKey ID>:<AccessKey Secret>' \ -d '{ "userAccount": "<cloud account ID>", "trafficStrategy": "REPLICA_TYPE", "replicaParams": "[{\"Value\":\"FULL\"}]", "balancedStrategy": "AUTO_BALANCE", "disasterRecoveryStrategy": "NO", "serviceType": "OBPROXY_READWRITE", "proxySetting": { "mode": "k8s_shared", "deploymentArchitecture": "single_az_deployment", "zone": [ "ap-southeast-1a" ], "slaveZone": [], "nodeCpu": 1 } }'Specify the zones in zoneIdList for an account that does not support custom proxy configurations.
curl --digest -X POST \ 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/privatelink/readwrite?requestId={requestId}' \ -H 'Content-Type: application/json' \ -u '<AccessKey ID>:<AccessKey Secret>' \ -d '{ "userAccount": "<cloud account ID>", "trafficStrategy": "REPLICA_TYPE", "replicaParams": "[{\"Value\":\"FULL\"}]", "balancedStrategy": "AUTO_BALANCE", "disasterRecoveryStrategy": "NO", "serviceType": "OBPROXY_READWRITE", "zoneIdList": [ "ap-southeast-1a" ] }'
Response example
{
"code": "200",
"message": "success",
"data": {
"resourceId": "privatelink-rw-xxxxxx",
"status": "Creating",
"requestId": "xxxxxx"
},
"server": "xxx.xxx.x.xxx:xxxx"
}