Description
This API is used to implement 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 OCP application service must be used to authenticate the caller.
Request path
POST /api/v2/ob/clusters/{id}/tenants/{tenantId}/failover
Request parameters
path:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 3000010 | The ID of the cluster in OCP to which the standby tenant belongs. |
| tenantId | Integer | Yes | 2000025 | The ID of the standby tenant in OCP. |
body:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| serviceName | String | No | ServiceB | The 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 Status specification. |
| 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/2000025/failover
{
"serviceName":"ServiceB"
}
Return example
{
"data": {
"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"
}
