# Perform a switchover
Description
You can call this operation to perform a switchover between the primary and standby tenants.
Call description
Prerequisites
You have the permission to modify tenants.
For more information about the permissions, see Overview and Overview.
You have passed the authentication for the OceanBase Cloud Platform (OCP) application service.
Request path
POST /api/v2/ob/clusters/{id}/tenants/{tenantId}/switchover
Request parameters
Path parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| id | Integer | Yes | 1 | The ID of the cluster. |
| tenantId | Integer | Yes | 1001 | The ID of the tenant. |
Body parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| tenantId | Long | Yes | 1 | The ID of the primary tenant. |
| standbyTenantId | Long | Yes | 2 | The ID of the standby tenant. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| data | TaskInstance | The information about the asynchronous task. For more information, see Task return structure. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The amount of 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. This trace ID is used for troubleshooting. |
| server | String | The address of the application server that responded to the request. |
Examples
Sample request
POST /api/v2/ob/clusters/{id}/tenants/{tenantId}/switchover
Body:
{
"tenantId": 1,
"standbyTenantId": 2
}
Sample response
{
"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"
}