欢迎访问 OceanBase 官网获取更多信息:https://www.oceanbase.com/
功能说明
获取数据库列表时使用的接口。
调用说明
接口约束
调用者需要通过 OCP 应用服务鉴权。
调用者需要具备指定租户的读权限。
请求路径
GET /api/v2/ob/clusters/{id}/tenants/{tenantId}/databases
请求参数
path 参数
参数 | 类型 | 必选 | 示例值 | 描述 |
|---|---|---|---|---|
id | Integer | 是 | 1 | 集群 ID |
tenantId | Integer | 是 | 5 | 租户 ID |
返回结果
参数 | 类型 | 说明 |
|---|---|---|
data | Object | 包含 contents。 |
├─ contents | Array | 数据库的列表,数据库数据结构见下表。 |
successful | Boolean | 请求是否成功。 |
timestamp | Datetime | 服务端完成请求的时间戳。 |
duration | Integer | 服务端处理请求的时间(毫秒)。 |
status | Integer | 符合 HTTP Status 规范的编码。 |
traceId | String | 请求的 Trace ID,用于排查问题。 |
server | String | 响应请求的服务端的地址。 |
数据库的数据结构
参数 | 类型 | 说明 |
|---|---|---|
dbName | String | 数据库名 |
charset | String | 字符集 |
collation | String | 校对集 |
primaryZone | String | Zone 优先级 |
readonly | Boolean | 是否只读 |
createTime | Datetime | 创建时间 |
connectionUrls | Array | OBProxy与连接串的列表 |
├─ connectionStringType | String | 连接串类型,取值范围: * OBPROXY * DIRECT 直连 |
├─ obProxyAddress | String | OBProxy 地址 仅当连接串类型为 OBPROXY 时有效 |
├─ obProxyPort | Integer | OBProxy 端口 仅当连接串类型为 OBPROXY 时有效 |
├─ connectionString | String | 连接串 |
requiredSize | Integer | 数据库的 required_size |
id | Integer | 数据库的 ID |
示例
请求示例
获取集群 1、租户 1000001 下的数据库列表。
GET /api/v2/ob/clusters/1/tenants/1000001/databases?id=1&tenantId=1000001
返回示例
{
"data": {
"contents": [
{
"charset": "utf8mb4",
"collation": "utf8mb4_general_ci",
"connectionUrls": [
{
"connectionString": "jdbc:mysql://xxx.xxx.xxx.xxx:2881/oceanbase",
"type": "DIRECT"
}
],
"createTime": "2021-09-06T11:38:44.51598+08:00",
"dbName": "oceanbase",
"id": 1100611139403777,
"readonly": false
},
{
"charset": "utf8mb4",
"collation": "utf8mb4_general_ci",
"connectionUrls": [
{
"connectionString": "jdbc:mysql://xxx.xxx.xxx.xxx:2881/information_schema",
"type": "DIRECT"
}
],
"createTime": "2021-09-06T11:38:44.559335+08:00",
"dbName": "information_schema",
"id": 1100611139403778,
"readonly": false
},
{
"charset": "utf8mb4",
"collation": "utf8mb4_general_ci",
"connectionUrls": [
{
"connectionString": "jdbc:mysql://xxx.xxx.xxx.xxx:2881/mysql",
"type": "DIRECT"
}
],
"createTime": "2021-09-06T11:38:44.550886+08:00",
"dbName": "mysql",
"id": 1100611139403779,
"readonly": false
},
{
"charset": "utf8mb4",
"collation": "utf8mb4_general_ci",
"connectionUrls": [
{
"connectionString": "jdbc:mysql://xxx.xxx.xxx.xxx:2881/test",
"type": "DIRECT"
}
],
"createTime": "2021-09-06T11:38:44.567822+08:00",
"dbName": "test",
"id": 1100611139404776,
"readonly": false
}
]
},
"duration": 429,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-06T20:22:14.85+08:00",
"traceId": "58294ce0e07243a4"
}
欢迎访问 OceanBase 官网获取更多信息:https://www.oceanbase.com/




