Description
This API is used to perform batch failover for primary and standby tenants.
Call instructions
API constraints
The caller must have the permission to modify tenants.
For more information about the permissions of the caller, see Overview of users and permissions.
The caller must be authenticated by using OCP.
Request path
POST /api/v2/ob/clusters/{id}/tenants/failover
Request parameters
path:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 3000010 | The cluster ID in OCP of the cluster to which the standby tenant belongs. |
body:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| failoverTenantItemList | FailoverTenantItem | No | SERVICE_A | The list of standby tenants to be switched over. For more information, see the description of the FailoverTenantItem data structure. |
FailoverTenantItem data structure
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| tenantId | Long | Yes | 2000025 | The tenant ID in OCP of the standby tenant. |
| serviceName | String | No | serviceA | The service name of the new primary tenant. |
Return result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | TaskInstance | The asynchronous task information. For more information, see Task information. |
| successful | Boolean | Specifies whether the request is successful. |
| timestamp | Datetime | The timestamp indicating when the server completed 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 standard. |
| traceId | String | The Trace ID of the request, which is used to troubleshoot issues. |
| server | String | The address of the application service that responded to the request. |
Examples
Request example
POST /api/v2/ob/clusters/3000010/tenants/failover
{
"failoverTenantItemList":[
{
"tenantId" : 2000025,
"serviceName": "serviceA"
}
]
}
Return example
{
"data": {
"contents": [
{
"clusterId": 3000010,
"creator": "admin",
"executor": "xxx.xxx.xxx.xxx",
"id": 12022226,
"name": "Failover tenant",
"operation": "EXECUTE",
"prohibitRollback": false,
"startTime": "2024-07-23T17:42:34.056+08:00",
"status": "RUNNING",
"subtasks": [
{
"description": "Failover to primary tenant",
"downstreams": [
13025785
],
"id": 13025788,
"name": "Failover to primary tenant",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": true,
"runTime": 1,
"seriesId": 2,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025787
]
},
{
"description": "Reset log restore source",
"downstreams": [
13025788
],
"id": 13025787,
"name": "Reset log restore source",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 3,
"status": "READY",
"timeout": 1800,
"upstreams": []
},
{
"description": "Create tenant service name",
"downstreams": [
13025789
],
"id": 13025786,
"name": "Create tenant service name",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 0,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025785
]
},
{
"description": "Update primary tenant info task",
"downstreams": [],
"id": 13025789,
"name": "Update primary tenant info task",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": true,
"runTime": 1,
"seriesId": 4,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025786
]
},
{
"description": "Upgrade tenant data version",
"downstreams": [
13025786
],
"id": 13025785,
"name": "Upgrade tenant data version",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 1,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025788
]
}
],
"taskDefinitionId": -1,
"tenantId": 2000025,
"type": "MANUAL"
}
]
},
"duration": 154,
"server": "3af57a8e6b",
"status": 200,
"successful": true,
"timestamp": "2024-07-23T17:42:34.069+08:00",
"traceId": "2692bd8d54b25810"
}
