Features
This API is used for the daily switchover of primary and standby tenants.
API details
Constraints
The caller must have the permission to modify the tenant.
For more information about the permissions of the caller, see Overview.
The caller must pass the authentication for OCP application services.
Request path
POST /api/v2/ob/clusters/{id}/tenants/{tenantId}/switchover
Request parameters
path:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| id | Long | Yes | 3000009 | The cluster ID of the primary tenant on the OCP side. |
| tenantId | Long | Yes | 2000022 | The tenant ID of the primary tenant in OCP. |
body:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| tenantId | Long | Yes | 2000022 | The tenant ID of the primary tenant in OCP. |
| standbyTenantId | Long | Yes | 2000002 | The tenant ID of the standby tenant in OCP. |
| standbyOcpClusterId | Long | No | 100001 | The ID of the OCP cluster where the standby tenant is located. This parameter is required when OCP is in multi-cluster mode. |
Response parameters
Parameter |
Type |
Description |
|---|---|---|
| data | TaskInstance | Information about the asynchronous task. For more information, see Task information. |
| successful | Boolean | Whether the request is 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 | An encoding that complies with the HTTP Status specification. |
| traceId | String | The trace ID of the request, used for troubleshooting. |
| server | String | The address of the application service that responded to the request. |
Examples
Request example
path:
POST /api/v2/ob/clusters/3000009/tenants/2000022/switchover
body:
{
"tenantId": 2000022,
"standbyTenantId": 2000002
}
Response example
{
"data": {
"clusterId": 3000009,
"creator": "admin",
"executor": "xxx.xxx.xxx.xxx",
"id": 12022212,
"name": "Switchover ob tenant for network mode",
"operation": "EXECUTE",
"prohibitRollback": false,
"startTime": "2024-07-23T17:20:55.929+08:00",
"status": "RUNNING",
"subtasks": [
{
"description": "Wait all relation tenants accessible",
"downstreams": [
13025741
],
"id": 13025745,
"name": "Wait all relation tenants accessible",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 0,
"status": "PENDING",
"timeout": 3600,
"upstreams": [
13025747
]
},
{
"description": "Switch primary tenant to standby",
"downstreams": [
13025740
],
"id": 13025741,
"name": "Switch primary tenant to standby",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 1,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025745
]
},
{
"description": "Create standby tenant read only user",
"downstreams": [
13025745
],
"id": 13025747,
"name": "Create standby tenant read only user",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 5,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025743
]
},
{
"description": "Switchover standby tenant to primary",
"downstreams": [
13025742
],
"id": 13025740,
"name": "Switchover standby tenant to primary",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": true,
"runTime": 1,
"seriesId": 7,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025741
]
},
{
"description": "Update log restore source",
"downstreams": [
13025746
],
"id": 13025744,
"name": "Update log restore source",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": 0,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 8,
"status": "PENDING",
"timeout": 900,
"upstreams": [
13025742
]
},
{
"description": "Reset switchover tenant info",
"downstreams": [],
"id": 13025748,
"name": "Reset switchover tenant info",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 6,
"status": "PENDING",
"timeout": 120,
"upstreams": [
13025739
]
},
{
"description": "Restart tenant service name if started",
"downstreams": [
13025739
],
"id": 13025746,
"name": "Restart tenant service name if started",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 9,
"status": "PENDING",
"timeout": 600,
"upstreams": [
13025744
]
},
{
"description": "Update tenant role in meta",
"downstreams": [
13025748
],
"id": 13025739,
"name": "Update tenant role in meta",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 4,
"status": "PENDING",
"timeout": 120,
"upstreams": [
13025746
]
},
{
"description": "Reset log restore source",
"downstreams": [
13025744
],
"id": 13025742,
"name": "Reset log restore source",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 2,
"status": "PENDING",
"timeout": 1800,
"upstreams": [
13025740
]
},
{
"description": "Prepare switchover tenant",
"downstreams": [
13025747
],
"id": 13025743,
"name": "Prepare switchover tenant",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 3,
"status": "READY",
"timeout": 60,
"upstreams": []
}
],
"taskDefinitionId": -1,
"tenantId": 2000022,
"type": "MANUAL"
},
"duration": 396,
"server": "3af57a8e6b",
"status": 200,
"successful": true,
"timestamp": "2024-07-23T17:20:55.98+08:00",
"traceId": "94bc249dd98d432f"
}
