Description
This API is used to perform daily switchover of 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 through OCP application services.
Request path
POST /api/v2/ob/clusters/{id}/tenants/{tenantId}/switchover
Request parameters
path:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 3000009 | The cluster ID of the primary tenant in OCP. |
| tenantId | Integer | 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 cluster ID of the standby tenant in OCP. This parameter is required only when OCP is in multi-cluster mode. |
Return result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | TaskInstance | Asynchronous task information. 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. |
| 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/3000009/tenants/2000022/switchover
{
"tenantId": 2000022,
"standbyTenantId": 2000002
}
Return 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"
}
