Description
This API is used to perform batch daily switchover operations on primary and standby tenants.
Call instructions
API constraints
The caller must have the permissions to modify tenants.
For more information about the permissions of the caller, see Overview of users and permissions.
The caller must be authenticated through OCP application service.
Request path
POST /api/v2/ob/clusters/{id}/tenants/switchover
Request parameters
path:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 3000010 | The ID of the cluster in OCP to which the primary tenant belongs. |
body:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| tenantParamList | SwitchoverObTenantParam | Yes | - | Each item in the list is a primary or standby tenant that needs to be switched over. For more information, see the SwitchoverObTenantParam data structure. |
SwitchoverObTenantParam data structure
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| tenantId | Long | Yes | 2000025 | The ID of the primary tenant in OCP. |
| standbyTenantId | Long | Yes | 2000002 | The ID of the standby tenant in OCP. |
| standbyOcpClusterId | Long | No | 100001 | The ID of the OCP cluster in which the standby tenant is located. This parameter is required when OCP is in multi-cluster mode. |
Return result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | TaskInstance | Information about multiple asynchronous tasks. For more information, see Task information. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp 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 for troubleshooting. |
| server | String | The address of the application service that responded to the request. |
Examples
Request example
POST /api/v2/ob/clusters/3000010/tenants/switchover
{
"tenantParamList":[
{
"tenantId": 2000025,
"standbyTenantId": 2000002
}
]
}
Return example
{
"data": {
"contents": [
{
"clusterId": 3000010,
"creator": "admin",
"executor": "xxx.xxx.xxx.xxx",
"id": 12022221,
"name": "Switchover ob tenant for network mode",
"operation": "EXECUTE",
"prohibitRollback": false,
"startTime": "2024-07-23T17:38:33.977+08:00",
"status": "RUNNING",
"subtasks": [
{
"description": "Update log restore source",
"downstreams": [
13025765
],
"id": 13025763,
"name": "Update log restore source",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": 0,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 7,
"status": "PENDING",
"timeout": 900,
"upstreams": [
13025759
]
},
{
"description": "Switchover standby tenant to primary",
"downstreams": [
13025759
],
"id": 13025760,
"name": "Switchover standby tenant to primary",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": true,
"runTime": 1,
"seriesId": 5,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025758
]
},
{
"description": "Reset log restore source",
"downstreams": [
13025763
],
"id": 13025759,
"name": "Reset log restore source",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 2,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025760
]
},
{
"description": "Create standby tenant read only user",
"downstreams": [
13025757
],
"id": 13025762,
"name": "Create standby tenant read only user",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 0,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025761
]
},
{
"description": "Reset switchover tenant info",
"downstreams": [],
"id": 13025764,
"name": "Reset switchover tenant info",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 3,
"status": "PENDING",
"timeout": 120,
"upstreams": [
13025766
]
},
{
"description": "Wait all relation tenants accessible",
"downstreams": [
13025758
],
"id": 13025757,
"name": "Wait all relation tenants accessible",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 8,
"status": "PENDING",
"timeout": 3600,
"upstreams": [
13025762
]
},
{
"description": "Restart tenant service name if started",
"downstreams": [
13025766
],
"id": 13025765,
"name": "Restart tenant service name if started",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 6,
"status": "PENDING",
"timeout": 600,
"upstreams": [
13025763
]
},
{
"description": "Update tenant role in meta",
"downstreams": [
13025764
],
"id": 13025766,
"name": "Update tenant role in meta",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 9,
"status": "PENDING",
"timeout": 120,
"upstreams": [
13025765
]
},
{
"description": "Switch primary tenant to standby",
"downstreams": [
13025760
],
"id": 13025758,
"name": "Switch primary tenant to standby",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 4,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025757
]
},
{
"description": "Prepare switchover tenant",
"downstreams": [
13025762
],
"id": 13025761,
"name": "Prepare switchover tenant",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 1,
"status": "READY",
"timeout": 60,
"upstreams": []
}
],
"taskDefinitionId": -1,
"tenantId": 2000025,
"type": "MANUAL"
}
]
},
"duration": 331,
"server": "3af57a8e6b",
"status": 200,
"successful": true,
"timestamp": "2024-07-23T17:38:34.021+08:00",
"traceId": "1d576119daa4860a"
}
