This topic describes how to query the status information of an OceanBase cluster.
How to call this API
API constraints
obshell Server will perform a security check on the API. For more information, see API hybrid encryption.
Request path
GET /api/v1/ob/info
Response
| Parameter | Type | Description |
|---|---|---|
| successful | bool | Whether the request is successful. |
| timestamp | time.Time | The timestamp when the request is processed on the server. |
| duration | int | The time taken to process the request on the server (in ms). |
| status | int | The HTTP status code. |
| traceId | string | The trace ID of the request. |
| data | ObInfoResp | ObInfoResp contains agent_info and obcluster_info. agent_info contains data about obshell. obcluster_info contains data about all OBServer nodes in the cluster. For more information, see the Data structure of ObInfoResp section below. |
| error | ApiError | The error that occurred during the request, which contains the following information:
|
The data structure of ObInfoResp is as follows:
| Module | Parameter | Type | Description |
|---|---|---|---|
| agent_info | ip | string | The IP address of the node. |
| port | int | The port number of the node. | |
| zone | string | The zone to which the node belongs. | |
| identity | string | The identity of the node. When the identity of the requested node is SINGLE, information about only the node itself is returned. Otherwise, information about all nodes in the cluster is returned. |
|
| version | string | The version number of obshell. | |
| obcluster_info | name | string | The name of the OceanBase cluster. |
| version | string | The version number of OceanBase Database. | |
| topology | map[string][]ServerConfig | The topology of the OceanBase cluster. The topology information of all zones in the cluster is included in the topology. Each OBServer node is represented by a ServerConfig. For more information, see the Data structure of ServerConfig section below. |
The data structure of ServerConfig is as follows:
| Parameter | Type | Description |
|---|---|---|
| svr_ip | string | The IP address of the OBServer node. |
| svr_port | int | The port number of the OBServer node. |
| sql_port | int | The port number of the SQL service protocol of the OBServer node. |
| agent_port | int | The port number of the obshell service. |
| with_rootserver | string | Whether the cluster has the RootService (RS). |
| status | string | The status of the OBServer node. |
Examples
Request example
GET 10.10.10.1:2886/api/v1/ob/info
Response example
The example response returns the information of all nodes in the initialized cluster and the topology information of the OceanBase cluster. The OceanBase cluster contains two zones, with an OBServer node in each zone.
{
"successful": true,
"timestamp": "2024-01-09T20:03:14.33717735+08:00",
"duration": 14,
"status": 200,
"traceId": "f06339705f167a89",
"data": {
"agent_info": [
{
"ip": "10.10.10.1",
"port": 2886,
"zone": "zone1",
"identity": "CLUSTER AGENT",
"version": "4.2.1.0-0"
},
{
"ip": "10.10.10.2",
"port": 2886,
"zone": "zone2",
"identity": "CLUSTER AGENT",
"version": "4.2.1.0-0"
}
],
"obcluster_info": {
"name": "test",
"version": "5.7.25-OceanBase_CE-v4.2.0.0",
"topology": {
"zone1": [
{
"svr_ip": "10.10.10.1",
"svr_port": 2882,
"sql_port": 2881,
"agent_port": 2886,
"with_rootserver": "YES",
"status": "ACTIVE"
}
],
"zone2": [
{
"svr_ip": "10.10.10.2",
"svr_port": 2882,
"sql_port": 2881,
"agent_port": 2886,
"with_rootserver": "NO",
"status": "ACTIVE"
}
]
}
}
}
}