This topic describes how to query the status information of an OceanBase cluster.
References
API constraints
obshell Server will perform security checks on the API. For more information, see API hybrid encryption.
Request path
GET /api/v1/ob/info
Response
| Parameter | Type | Description |
|---|---|---|
| successful | bool | Specifies whether the request is successful. |
| timestamp | time.Time | The timestamp when the service completes the request. |
| duration | int | The time (in ms) that the service takes to process the request. |
| status | int | The status code that complies with the HTTP Status standard. |
| traceId | string | The trace ID of the request. |
| data | ObInfoResp | ObInfoResp contains agent_info and obcluster_info. agent_info contains data about obshell, and 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 occurs during the request. It 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 node is SINGLE, the information of only the node is returned. Otherwise, the information of 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 object. 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 | Specifies whether the cluster has 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 about all nodes in the initialized cluster and the topology information about 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"
}
]
}
}
}
}