Overview
Call CreateReadonlyPrivatelink to create a private read-only address for a tenant in the specified OceanBase Cloud instance. Use this address to access the tenant's read-only replicas over a private network and separate read traffic from write traffic. A successful request returns information about the created resource.
API details
Constraints
The caller must have an AccessKey for accessing multi-cloud APIs. 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/readonly
Request parameters
Path
Name |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| instanceId | string | Yes | The ID of the OceanBase Cloud instance. | obcluster-***** |
| tenantId | string | Yes | The ID of the tenant. | t4louaeei**** |
Query
Name |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| requestId | string | Yes | The request ID, used for tracking. | 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, which defines the rules for distributing read-only traffic. | 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 | When trafficStrategy is REPLICA, you can specify fallback replicas to receive read traffic if all preferred replicas are unavailable. Pass a JSON array as a string. Each Value is the name of the logical zone that contains a fallback replica. |
[{"Value":"<fallback-replica-logical-zone-name>"}] |
| balancedStrategy | string | No | The load balancing strategy. | AUTO_BALANCE |
| disasterRecoveryStrategy | string | No | The disaster recovery strategy. | NO |
| serviceType | string | Yes | The address type. | OBPROXY_READONLY |
| proxySetting | Object | No | Database proxy configuration for the private read-only 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 |
|---|---|---|
| requestId | string | The request ID. |
| data | object | The created result data. |
| server | string | The server address that responded to the request. |
Examples
Request example
Create a private read-only address with a specified proxy configuration and a full-featured replica (
FULL).curl --digest -X POST \ -H "Content-Type: application/json" \ -u '<AccessKey ID>:<AccessKey Secret>' \ "https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/privatelink/readonly?requestId={requestId}" \ -d '{ "userAccount": "<cloud account ID>", "trafficStrategy": "REPLICA_TYPE", "replicaParams": "[{\"Value\":\"FULL\"}]", "balancedStrategy": "AUTO_BALANCE", "disasterRecoveryStrategy": "NO", "serviceType": "OBPROXY_READONLY", "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 \ -H "Content-Type: application/json" \ -u '<AccessKey ID>:<AccessKey Secret>' \ "https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/privatelink/readonly?requestId={requestId}" \ -d '{ "userAccount": "<cloud account ID>", "trafficStrategy": "REPLICA_TYPE", "replicaParams": "[{\"Value\":\"FULL\"}]", "balancedStrategy": "AUTO_BALANCE", "disasterRecoveryStrategy": "NO", "serviceType": "OBPROXY_READONLY", "zoneIdList": [ "ap-southeast-1a" ] }'
Response example
{
"requestId": "xxxxxx",
"data": {
"privatelinkId": "pl-xxxxxx",
"status": "CREATING",
"address": "xxxxxx.private.oceanbase.com"
},
"server": "xxx.xxx.x.xxx:xxxx"
}