Feature description
This API is used to create a standby tenant for the specified OceanBase cluster.
Call instructions
Interface constraints
The caller must have the permission to modify clusters.
For more information about the permissions of the caller, see Overview of users and permissions.
The OCP application service must be used for authentication.
Request path
POST /api/v2/ob/clusters/{id}/tenants/createStandbyTenant
Request parameters
path:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 3000010 | The cluster ID in OCP to which the target tenant belongs. |
body:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| name | String | Yes | standbyA | The name of the tenant. |
| primaryZone | String | No | zone1;zone2;zone3 | The primary zone setting. |
| primaryTenantId | Integer | Yes | 1 | The primary tenant's primary key ID, which is the tenant ID of the primary tenant in OCP. |
| logTransportMode | String | Yes | NETWORK | The log transport mode, which can be NETWORK (log backup) or LOG_BACKUP (network). |
| restoreTenant | Boolean | No | false | Specifies whether to restore the standby tenant using a backup set. This parameter is valid only when logTransportMode is set to NETWORK, indicating whether to create a network standby database based on the backup set. |
| enableArbitration | Boolean | No | false | Specifies whether to enable arbitration. |
| backupConfig | BackupConfigParam | No | - | The backup set information. This parameter is not required when directly creating a network standby database or using an existing backup strategy in OCP. For more information, see the BackupConfigParam data structure. |
| zones | ZoneParam | Yes | - | For more information, see the ZoneParam data structure. |
| parameters | TenantParameterParam | No | - | For more information, see the TenantParameterParam data structure. |
| description | String | No | this is standby tenant | The description. |
| loadType | Enum | No | EXPRESS_OLTP | The load type: |
BackupConfigParam data structure
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| backupStorageType | Enum | Yes | BACKUP_STORAGE_FILE | |
| dataBackupUrl | String | Yes | /obbackup/clusterA/tenantA/data |
The data backup directory. |
| logBackupUrl | String | Yes | /obbackup/clusterA/tenantA/clog |
The log backup directory. |
| ossSecretModel | ObjectStorageSecretParam | No | - | The object storage key information, which is required only when the storage mode is OSS, COS, or S3. For more information, see the ObjectStorageSecretParam data structure. |
ObjectStorageSecretParam data structure
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| endpoint | String | Yes | oss.endpoint.sahnghai.com |
The object storage domain name. |
| accessKeyId | String | Yes | - | The object storage access key. |
| accessKeySecret | String | Yes | - | The object storage secret key. |
| region | String | No | - | The region information, which can be empty. This parameter is required only for AWS native S3 storage media. |
| appId | String | No | - | The APP ID, which is required only for COS storage. |
ZoneParam data structure
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| name | String | Yes | zone1 | The name of the zone in the cluster. |
| replicaType | String | Yes | FULL | The replica type. Valid values: |
| resourcePool | Object | Yes | - | The resource pool. |
TenantParameterParam data structure
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| name | String | Yes | ob_default_replica_num | The parameter, which specifies the default number of OceanBase Database replicas. |
| value | String | Yes | 2 | The parameter value. |
| parameterType | String | Yes | OB_SYSTEM_VARIABLE | The parameter type, which can be OB_SYSTEM_VARIABLE (variable) or OB_TENANT_PARAMETER (parameter). |
Return result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | Object | Asynchronous task information. For more information, see Task information. |
| successful | Boolean | Indicates whether the request is successful. |
| timestamp | Datetime | The timestamp indicating when the server finishes the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | The HTTP status code that conforms to the HTTP status code specification. |
| traceId | String | The Trace ID of the request, which is used for troubleshooting. |
| server | String | The address of the application service that responds to the request. |
Example
Request example
POST /api/v2/ob/clusters/3000010/tenants/createStandbyTenant
{
"enableArbitration": false,
"backupConfig": null,
"zones": [
{
"name": "zone1",
"replicaType": "FULL",
"resourcePool": {
"unitSpecName": "S1",
"unitCount": 1
}
}
],
"primaryTenantId": 2000022,
"name": "ohayo_2",
"logTransportMode": "NETWORK",
"serviceName": "SERVICE_C",
"loadType":"EXPRESS_OLTP",
"parameters": [
{
"name": "connect_timeout",
"value": "2000",
"parameterType": "OB_SYSTEM_VARIABLE"
}
]
}
Response example
{
"data": {
"clusterId": 3000010,
"creator": "admin",
"executor": "xxx.xxx.xxx.xxx",
"id": 12022234,
"name": "Create network standby tenant",
"operation": "EXECUTE",
"prohibitRollback": false,
"startTime": "2024-07-23T17:55:37.066+08:00",
"status": "RUNNING",
"subtasks": [
{
"description": "Create tenant service name",
"downstreams": [
13025800
],
"id": 13025806,
"name": "Create tenant service name",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 2,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025803
]
},
{
"description": "Create standby tenant read only user",
"downstreams": [
13025804
],
"id": 13025808,
"name": "Create standby tenant read only user",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 4,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025807
]
},
{
"description": "Update tenant status",
"downstreams": [],
"id": 13025799,
"name": "Update tenant status",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 5,
"status": "PENDING",
"timeout": 300,
"upstreams": [
13025797
]
},
{
"description": "Sync tenant information",
"downstreams": [
13025797
],
"id": 13025800,
"name": "Sync tenant information",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 6,
"status": "PENDING",
"timeout": 300,
"upstreams": [
13025806
]
},
{
"description": "Create resource pool",
"downstreams": [
13025808
],
"id": 13025807,
"name": "Create resource pool",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 3,
"status": "PENDING",
"timeout": 600,
"upstreams": [
13025798
]
},
{
"description": "Set ob tenant parameters",
"downstreams": [
13025799
],
"id": 13025797,
"name": "Set ob tenant parameters",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 7,
"status": "PENDING",
"timeout": 300,
"upstreams": [
13025800
]
},
{
"description": "Check tenant log transport status ok",
"downstreams": [
13025806
],
"id": 13025803,
"name": "Check tenant log transport status ok",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 10,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025801
]
},
{
"description": "Wait all relation tenants accessible",
"downstreams": [
13025805
],
"id": 13025804,
"name": "Wait all relation tenants accessible",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 0,
"status": "PENDING",
"timeout": 3600,
"upstreams": [
13025808
]
},
{
"description": "Wait ob tenant accessible",
"downstreams": [
13025801
],
"id": 13025802,
"name": "Wait ob tenant accessible",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 9,
"status": "PENDING",
"timeout": 600,
"upstreams": [
13025805
]
},
{
"description": "Set standby tenant continuous recovery",
"downstreams": [
13025803
],
"id": 13025801,
"name": "Set standby tenant continuous recovery",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 1,
"status": "PENDING",
"timeout": 300,
"upstreams": [
13025802
]
},
{
"description": "Create standby tenant",
"downstreams": [
13025802
],
"id": 13025805,
"name": "Create standby tenant",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 11,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025804
]
},
{
"description": "Prepare create tenant",
"downstreams": [
13025807
],
"id": 13025798,
"name": "Prepare create tenant",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 8,
"status": "READY",
"timeout": 30,
"upstreams": []
}
],
"taskDefinitionId": -1,
"tenantId": 2000026,
"type": "MANUAL"
},
"duration": 197,
"server": "3af57a8e6b",
"status": 200,
"successful": true,
"timestamp": "2024-07-23T17:55:37.11+08:00",
"traceId": "ee452617f4e04661"
}
