This API is used to query the status of the OceanBase cluster that contains the OBServer node where OceanBase Shell (OBShell) is stored.
Call description
Request path
GET /api/v1/ob/info
Response parameters
| Parameter | Type | Description |
|---|---|---|
| successful | Boolean | Indicates whether the request is successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The amount of time taken by the server to process the request, in milliseconds. |
| status | Integer | The HTTP status code. |
| traceId | String | The trace ID of the request. |
| data | Object | For more information, see the data structure of ObInfoResp. |
| error | Object | The information about the error that occurred. |
ObInfoResp contains the agent_info and obcluster_info sections.
The agent_info section contains the information of nodes. The following table describes the information of a node.
| Parameter | Type | Description |
|---|---|---|
| ip | String | The IP address of the node. |
| port | Integer | The port number of the node. |
| zone | String | The zone to which the node belongs. |
| identity | String | The identity of the node. |
| version | String | The version of OBShell. |
If the identity of the requested node is SINGLE, only the information of the requested node is returned. Otherwise, the information of all nodes in the cluster is returned.
The following table describes the information contained in the obcluster_info section.
| Parameter | Type | Description |
|---|---|---|
| name | String | The name of the OceanBase cluster. |
| version | String | The version of OceanBase Database. |
| topology | Map[string][Object] | The topology of the OceanBase cluster. For more information, see the data structure of ServerConfig. |
The topology parameter indicates the topology information of all zones in the cluster. The following table describes the data structure of ServerConfig, which indicates the information of an OBServer node.
| Parameter | Type | Description |
|---|---|---|
| svr_ip | String | The IP address of the node. |
| svr_port | Integer | The port number of the node. |
| sql_port | Integer | The port number for the SQL service protocol of the node. |
| agent_port | Integer | The port number for the OBShell service. |
| with_rootserver | String | Indicates whether the node is the RootService server of the cluster. |
| status | String | The status of the node. |
Examples
Sample request
GET xxx.xxx.1:2886/api/v1/ob/info
Sample response
{
"successful": true,
"timestamp": "2024-01-09T20:03:14.33717735+08:00",
"duration": 14,
"status": 200,
"traceId": "f06339705f167a89",
"data": {
"agent_info": [
{
"ip": "xxx.xxx.1",
"port": 2886,
"zone": "zone1",
"identity": "CLUSTER AGENT",
"version": "4.2.1.0-0"
},
{
"ip": "xxx.xxx.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": "xxx.xxx.1",
"svr_port": 2882,
"sql_port": 2881,
"agent_port": 2886,
"with_rootserver": "YES",
"status": "ACTIVE"
}
],
"zone2": [
{
"svr_ip": "xxx.xxx.2",
"svr_port": 2882,
"sql_port": 2881,
"agent_port": 2886,
"with_rootserver": "NO",
"status": "ACTIVE"
}
]
}
}
}
}
The sample response displays the information of all nodes in an initialized OceanBase cluster and the topology information of the cluster. You can see that the OceanBase cluster contains two zones, and each zone contains one OBServer node.