首批通过分布式安全可靠测评,为关键业务系统打造
设置 Server 级配置
更新时间:2026-04-10 11:58:35
设置 Server 级配置时采取全量覆盖策略,即原有配置将被新配置完全替代。
调用说明
接口约束
obshell Server 会对该 API 进行安全校验,详细介绍可参见 API 混合加密。
请求路径
POST /api/v1/observer/config
PUT /api/v1/observer/config
请求参数
| 参数 | 类型 | 必选 | 示例值 | 描述 |
|---|---|---|---|---|
| observerConfig | map[string]string | 是 | { "mysql_port": "2881", "rpc_port": "2882", "memory_limit": "16G", "system_memory": "8G" } |
设置 OBServer 节点的配置项。 |
| scope | Scope | 是 | 详情可参见下文 请求示例 | 设置应用该配置的 OBServer 节点的范围。详细的内容介绍可参见下文 Scope 信息的数据结构。 |
Scope 信息的数据结构如下:
| 参数 | 类型 | 必选 | 示例值 | 说明 |
|---|---|---|---|---|
| type | string | 是 | "SERVER" | 设置配置的生效级别,可取值为 GLOBAL,ZONE,SERVER。 |
| target | []string | 否 | 示例值:["10.10.10.1:2886", "10.10.10.2:2886"] 或者 ["zone1","zone2"] | 当 type 为 SERVER 时,设置为 OBServer 节点的列表;当 type 为 ZONE 时,设置为 Zone 的列表;当 type 为 GLOBAL 时,无需设置。 |
返回结果
| 参数 | 类型 | 说明 |
|---|---|---|
| successful | bool | 请求是否成功。 |
| timestamp | time.Time | 服务端完成请求的时间戳。 |
| duration | int | 服务端处理请求的时间(毫秒)。 |
| status | int | 符合 HTTP Status 规范的编码。 |
| traceId | string | 请求的 Trace ID。 |
| data | DagDetailDTO | 详情参见下文 DagDetailDTO 信息的数据结构。 |
| error | ApiError | 请求产生的 Error,包含如下信息:
|
DagDetailDTO 信息的数据结构如下:
| 参数 | 类型 | 说明 |
|---|---|---|
| id | string | DAG 通用 ID。 |
| dag_id | int | DAG id,是记录在 OceanBase 数据库中的主键。 |
| name | string | DAG 名称。 |
| stage | int | DAG 的当前执行阶段。 |
| max_stage | int | DAG 执行过程中的总阶段数。 |
| state | string | DAG 执行状态。 |
| operator | string | DAG 执行操作类型。 |
| start_time | time.Time | DAG 执行起始时间。 |
| end_time | time.Time | DAG 执行结束时间。 |
| additional_data | map[string]any | DAG 其他数据。 |
| nodes | []NodeDetailDTO | DAG 内的所有 Node 信息,详见 获取 Node 的详细信息。 |
示例
请求示例
POST 10.10.10.1:2886/api/v1/observer/config
{
"observerConfig": {
"redoDir":"/data/workspace/redo",
"dataDir":"/data/workspace/data",
"mysql_port": "2881",
"rpc_port": "2882",
"datafile_size":"24G",
"cpu_count":"16",
"memory_limit": "16G",
"system_memory": "8G",
"log_disk_size":"40G"
},
"scope": {
"target": [
"10.10.10.1:2886",
"10.10.10.2:2886"
],
"type": "SERVER"
}
}
返回示例
{
"successful": true,
"timestamp": "2024-01-09T17:11:43.385889278+08:00",
"duration": 1,
"status": 200,
"traceId": "877fe32b83634153",
"data": {
"id": "22130706433028869",
"dag_id": 4,
"name": "Update observer config",
"stage": 1,
"max_stage": 1,
"state": "READY",
"operator": "RUN",
"start_time": "2024-01-09T17:11:43.384630643+08:00",
"end_time": "2024-01-09T17:11:43.384630643+08:00",
"additional_data": null,
"nodes": null
}
}
相关文档
除通过命令行调用 API 接口外,还可以通过 SDK 方法调用 API。
通过 obshell-sdk-python 请求 API 方法的介绍可参见 设置 Server 级配置。
通过 obshell-sdk-go 请求 API 方法的介绍可参见 设置 Server 级配置。