欢迎访问 OceanBase 官网获取更多信息:https://www.oceanbase.com/
功能说明
该接口用于查询目标 OceanBase 集群的所有服务器信息。
调用说明
接口约束
- 调用者需至少具备对目标 OceanBase 集群的只读权限。
关于调用者的权限,详情可参见 安全概述。
- 调用者需要通过 OCP 应用服务鉴权。
请求路径
GET /api/v2/ob/clusters/{clusterId}/servers
请求参数
参数 | 类型 | 必选 | 示例值 | 描述 |
|---|---|---|---|---|
clusterId | Integer | 是 | 1 | 目标集群的 ID。 |
regionName | String | 否 | Beijing | 查询在指定区域的 OB 服务器。 |
idcName | String | 否 | AZ1 | 查询在指定机房的 OB 服务器。 |
返回结果
基础数据结构
参数 | 类型 | 说明 |
|---|---|---|
data | Object | 请求的业务数据。 |
├─ contents | Array | 服务器信息的数组,数据结构见下表。 |
successful | Boolean | 请求是否成功。 |
timestamp | Datetime | 服务端完成请求的时间戳。 |
duration | Integer | 服务端处理请求的时间(毫秒)。 |
status | Integer | 符合 HTTP Status 规范的编码。 |
traceId | String | 请求的 Trace Id,用于排查问题。 |
server | String | 响应请求的应用服务的地址。 |
服务器的数据结构
参数 | 类型 | 说明 |
|---|---|---|
id | Integer | 服务器的 Id。 |
ip | String | 服务器的 IP 地址。 |
port | Integer | 服务器的 RPC 端口。 |
sqlPort | Integer | 服务器的 SQL 端口。 |
version | String | 服务器的 OB 版本。 |
withRootServer | Boolean | 是否带 Root Service。 |
status | String | 服务器的状态。 取值范围: * CREATING:创建中 * RUNNING:运行中 * STOPPING:停止中 * STOPPED:已停止 * STARTING:启动中 * RESTARTING:重启中 * DELETING:删除中 * UNAVAILABLE:不可用 * OPERATING:运维中 * DELETED:已删除 |
updateTime | Datetime | 服务器最后更新时间。 |
clusterId | Integer | 服务器所属集群的 ID。 |
zoneName | String | 服务器所属 Zone 的名称。 |
regionName | String | 服务器所属区域的名称。 |
idcName | String | 服务器所属机房的名称。 |
hostId | Integer | 服务器的主机 ID。 |
hostTypeName | String | 服务器的主机的类型。 |
startTime | Datetime | 服务器的启动时间。 |
stopTime | Datetime | 服务器的停止时间。 |
availableOperations | StringArray | 服务器的可用操作列表。 |
示例
请求示例
查询 ID 为 1 的集群中所有服务器信息的列表。
GET /api/v2/ob/clusters/1/servers
返回示例
{
"data": {
"contents": [
{
"clusterId": 1000002,
"hostId": 1000001,
"id": 1000001,
"innerStatus": "ACTIVE",
"ip": "xxx.xxx.xxx.xxx",
"port": 2882,
"sqlPort": 2881,
"startTime": "2020-11-29T22:30:42+08:00",
"status": "RUNNING",
"stopTime": "1970-01-01T08:00:00+08:00",
"updateTime": "2020-11-30T14:42:23+08:00",
"version": "2.2.73_20201117154111-b6aae37ffa2e72f45705508d7e5e93f9c48263b0(Nov 17 2020 16:09:04)",
"withRootserver": true,
"zoneName": "zone1"
}
]
},
"duration": 35,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2020-12-02T20:15:34.354+08:00",
"traceId": "83eb4afb44e54bb4"
}
欢迎访问 OceanBase 官网获取更多信息:https://www.oceanbase.com/




