首批通过分布式安全可靠测评,为关键业务系统打造
查询任务列表
更新时间:2026-04-14 11:55:54
功能说明
查询任务列表,支持根据不同参数进行过滤。
调用说明
接口约束
调用者需要具备 TASK_VIEWER 权限。
请求路径
GET /api/v2/tasks/instances
请求参数
body:
| 参数 | 类型 | 必选 | 示例值 | 描述 |
|---|---|---|---|---|
| name | String | 否 | Prepare host | 任务名称检索关键字,支持模糊匹配。 |
| status | StringArray | 否 | RUNNING,FAILED | 任务执行状态,取值范围: |
| type | String | 否 | MANUAL | 任务类型,取值范围: |
| cluterName | String | 否 | meta | 集群名称关键字,支持模糊匹配。 |
| clusterId | Long | 否 | 100 | 集群 ID。 |
| tenantName | String | 否 | SYS | 租户名称,需配合集群 ID 一起使用。 |
| tenantId | Long | 否 | 100 | 租户 ID。 |
| hostId | Long | 否 | 100 | 主机 ID。 |
| page | Integer | 否 | 1 | 分页页码,从 1 开始。 |
| size | Integer | 否 | 10 | 请求数据的分页大小。默认值:10,最大值:2000。 |
| sort | String | 否 | id,asc | 请求数据的排序规则。 |
返回结果
基础数据结构
| 参数 | 类型 | 说明 |
|---|---|---|
| data | Object | 请求的数据。 |
| ├─ contents | Array | BasicTaskInstance 的数组,详情参见 BasicTaskInstance 数据结构。 |
| ├─ page | Object | 分页信息,详情参见 page 参数说明。 |
| successful | Boolean | 请求是否成功。 |
| timestamp | Datetime | 服务端完成请求的时间戳。 |
| duration | Integer | 服务端处理请求的时间(毫秒)。 |
| status | Integer | 符合 HTTP Status 规范的编码。 |
| traceId | String | 请求的 Trace ID,用于排查问题。 |
| server | String | 响应请求的应用服务的地址。 |
BasicTaskInstance 数据结构
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Integer | 软件包 ID。 |
| name | String | 软件包名称。 |
| cluster | Object | 集群信息,详情参见 cluster 参数说明。 |
| tenant | Object | 租户信息,详情参见 tenant 参数说明。 |
| creator | Object | 任务创建者信息,详情参见 creator 参数说明。 |
| status | Integer | 任务执行状态,取值范围: |
| startTime | String | 任务开始时间。 |
| finishTime | String | 任务结束时间。 |
| subtasks | ObjectArray | BasicSubtaskInstance 数组,详情参见 BasicSubtaskInstance 数据结构。 |
| tags | Array | 标签列表,详情参见 InstanceFullTag 数据结构。 |
| operation | String | 任务操作,包括:execute、retry、rollback。 |
cluster 参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | 集群在 OCP 端的 ID。 |
| name | String | 集群名称。 |
| obClusterId | Long | 集群在 OceanBase 端的 ID。 |
| type | String | 集群类型,取值范围: |
tenant 参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | 租户在 OCP 端的 ID。 |
| name | String | 租户名称。 |
| obClusterId | Long | 租户在 OceanBase 端的 ID。 |
| mode | String | 租户模式,取值范围: |
creator 参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | 创建者用户 ID。 |
| name | String | 创建者用户名。 |
BasicSubtaskInstance 数据结构
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | 子任务实例 ID。 |
| name | String | 子任务名称。 |
| description | String | 子任务描述信息。 |
| status | String | 子任务状态,取值范围: |
| operation | String | 子任务操作,取值范围: |
InstanceFullTag 数据结构
| 参数 | 类型 | 说明 |
|---|---|---|
| clusterName | String | 集群名。 |
| clusterId | Long | OCP 侧集群 ID。 |
| obClusterId | Long | OceanBase 侧集群 ID。 |
| clusterType | String | 集群类型,包含: |
| zoneName | String | Zone 名。 |
| tenantName | String | 租户名。 |
| tenantId | Long | OCP 侧租户 ID。 |
| obTenantId | Long | OceanBase 侧租户 ID。 |
| tenantMode | String | 租户模式,包含: |
| tenantRole | String | 租户角色,包含: |
| obVersion | String | OceanBase 版本。 |
| serverId | Long | OBServer ID。 |
| arbitrationServiceId | Long | 仲裁服务 ID。 |
| arbitrationServiceGroupName | String | 仲裁服务组名称。 |
| arbitrationServiceGroupId | Long | 仲裁服务组 ID。 |
| arbitrationServiceSvrPort | Integer | 仲裁服务端口。 |
| obproxyClusterName | String | OBProxy 集群名。 |
| obproxyClusterId | Long | OBProxy 集群 ID。 |
| obproxyServerId | Long | OBProxy Server ID。 |
| hostId | Long | 主机 ID。 |
| svrIp | Long | 主机 IP。 |
| objectType | String | 任务关联对象的类型。 |
| deleted | Boolean | 标记当前任务关联的信息是否已经删除。 |
| binlogClusterName | String | Binlog 集群名。 |
| binlogClusterId | Long | Binlog 集群 ID。 |
| binlogServerId | Long | Binlog Server ID。 |
| tenantBinlogServiceId | Long | Binlog 实例 ID。 |
| binlogInstanceName | String | Binlog 实例名称。 |
page 参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| totalElements | Integer | 总记录数。 |
| totalPages | Integer | 总页数。 |
| number | Integer | 当前页码。 |
| size | Integer | 当前页大小。 |
示例
请求示例
GET /api/v2/tasks/instances
返回示例
{
"data": {
"contents": [
{
"cluster": {
"id": 1,
"name": "ob20daily.xiaojun.chengxj",
"obClusterId": 1,
"type": "PRIMARY"
},
"creator": {
"id": 200,
"name": "system"
},
"finishTime": "2021-08-12T13:40:09.573+08:00",
"id": 6202983,
"name": "Prepare tenant",
"startTime": "2021-08-06T17:37:58.01+08:00",
"status": "SUCCESSFUL",
"operation": "execute",
"tags": [
{
"clusterId": 1,
"clusterName": "ob20daily.xiaojun.chengxj",
"clusterType": "PRIMARY",
"deleted": false,
"obClusterId": 1,
"obVersion": "4.2.5.3"
}
],
"subtasks": [
{
"description": "Set whitelist",
"id": 9009988,
"name": "Set whitelist",
"operation": "EXECUTE",
"status": "PENDING"
},
{
"description": "Update tenant status",
"id": 9009989,
"name": "Update tenant status",
"operation": "EXECUTE",
"status": "PENDING"
},
{
"description": "Set super user password",
"id": 9009987,
"name": "Set super user password",
"operation": "ROLLBACK",
"status": "PENDING"
}
],
"tenant": {
"id": 169,
"mode": "ORACLE",
"name": "zhiqiong",
"obTenantId": 1584
}
},
{
"cluster": {
"id": 1,
"name": "ob20daily.xiaojun.chengxj",
"obClusterId": 1,
"type": "PRIMARY"
},
"creator": {
"id": 100,
"name": "admin"
},
"finishTime": "2021-08-04T19:19:05.158+08:00",
"id": 6175879,
"name": "Generate workload report",
"startTime": "2021-08-04T19:14:08.512+08:00",
"status": "SUCCESSFUL",
"subtasks": [
{
"description": "Wait node",
"id": 8976786,
"name": "Wait node",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
},
{
"description": "Store workload report",
"id": 8976793,
"name": "Store workload report",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
},
{
"description": "Generate report",
"id": 8976785,
"name": "Generate report",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
},
{
"description": "Generate report",
"id": 8976783,
"name": "Generate report",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
},
{
"description": "Generate report",
"id": 8976790,
"name": "Generate report",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
},
{
"description": "Generate report",
"id": 8976789,
"name": "Generate report",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
}
]
}
],
"page": {
"number": 1,
"size": 10,
"totalElements": 2,
"totalPages": 1
}
},
"duration": 95,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-08-25T14:30:27.27+08:00",
"traceId": "2592dcf6c88f41bf"
}