Feature description
This interface is used to perform pre-checks for the daily switchover of primary and standby tenants.
Call instructions
Interface constraints
The user must have the permission to modify tenants.
For more information about the permissions of the user, see Overview of users and permissions.
The user must be authenticated by OCP application service.
Request path
POST /api/v2/ob/clusters/{id}/tenants/{tenantId}/switchoverPreCheck
Request parameters
path:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 3000009 | The ID of the cluster to which the primary tenant belongs in the OCP console. |
| tenantId | Integer | Yes | 2000022 | The ID of the primary tenant in the OCP console. |
body:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| tenantId | Long | Yes | 2000022 | The ID of the primary tenant in the OCP console. |
| standbyTenantId | Long | Yes | 2000025 | The ID of the standby tenant in the OCP console. |
| standbyOcpClusterId | Long | No | 100001 | The ID of the cluster to which the standby tenant belongs in the OCP console. This parameter is required only when OCP is in multi-cluster mode. |
Returned result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | SwitchoverPreCheckResult | The check result. For more information, see SwitchoverPreCheckResult data structure. |
| successful | Boolean | Indicates whether the request is successful. |
| timestamp | Datetime | The timestamp 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. |
| 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. |
SwitchoverPreCheckResult data structure
Parameter |
Type |
Description |
|---|---|---|
| valid | Boolean | Indicates whether the precheck is passed. |
| tenantId | Long | The tenant ID of the primary tenant in OCP. |
| name | String | The name of the primary tenant. |
| clusterId | Long | The cluster ID of the primary tenant in OCP. |
| clusterName | String | The name of the cluster of the primary tenant. |
| standbyCheckResults | ObTenantPreCheckResult | The details. For more information, see ObTenantPreCheckResult data structure. |
ObTenantPreCheckResult data structure
Parameter |
Type |
Description |
|---|---|---|
| valid | Boolean | Indicates whether the standby tenant is allowed to switch. |
| tenantId | Long | The tenant ID of the standby tenant in OCP. |
| name | String | The name of the standby tenant. |
| clusterId | Long | The cluster ID of the standby tenant in OCP. |
| clusterName | String | The name of the cluster of the standby tenant. |
| syncScn | Long | The synchronization latency of the standby tenant. |
| primaryTenantServiceName | String | The name of the primary tenant service. |
| checkResults | PreCheckResult | The list of failed information. For more information, see PreCheckResult data structure. |
PreCheckResult data structure
Parameter |
Type |
Description |
|---|---|---|
| warning | Boolean | Indicates whether the item is a warning. If the value is true, the item is a warning and does not affect the switchover process. If the value is false, the item is an error and affects the switchover. |
| errorCode | String | The error code. |
| errorMessage | String | The error message. |
Example
Request example
POST /api/v2/ob/clusters/3000009/tenants/2000022/switchoverPreCheck
{
"tenantId": 2000022,
"standbyTenantId": 2000025
}
Response example
{
"data": {
"clusterId": 3000009,
"clusterName": "OB42_B",
"name": "ohayo_1",
"standbyCheckResults": [
{
"checkResults": [
{
"errorCode": "OBE26009",
"errorMessage": "The log synchronization latency of tenant ohayo_2 is 14883430 ms, which exceeds 10000 ms. This operation is not allowed.",
"warning": false
},
{
"errorCode": "OBE26107",
"errorMessage": "The primary and standby clusters where tenant ohayo_2 is located are not associated with a common ObProxy. Automatic routing cannot be achieved after the primary tenant is switched.",
"warning": true
}
],
"clusterId": 3000010,
"clusterName": "OB424_A",
"name": "ohayo_2",
"tenantId": 2000025,
"valid": false
}
],
"tenantId": 2000022,
"valid": false
},
"duration": 624,
"server": "3af57a8e6b",
"status": 200,
"successful": true,
"timestamp": "2024-07-23T17:15:57.809+08:00",
"traceId": "ba76464b48326028"
}
