This topic describes how to query the status of an OceanBase cluster.
How to call this API
API constraints
OBShell Server will verify the security of the API request. For more information, see API authentication based on public key 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 server completes the request. |
| duration | int | The time taken by the server to process the request (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 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. 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 itself is returned. Otherwise, the information of all nodes in the cluster is returned. |
|
| version | string | The version number of the OBShell used. | |
| 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 | Whether the node is the Root Service (RS) of the cluster. |
| 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 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"
}
]
}
}
}
}