This API operation is used to query the information about the OceanBase cluster that contains the OBServer node where OceanBase Shell (obshell) is stored.
Call description
Limitations
The obshell server verifies the security of requests to this API operation. For more information, see Hybrid encryption for API operations.
Request path
GET /api/v1/ob/info
Response parameters
| Parameter | Type | Description |
|---|---|---|
| successful | Boolean | Indicates whether the request is successful. |
| timestamp | time.Time | 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 | ObInfoResp | ObInfoResp contains the agent_info and obcluster_info sections. The agent_info section contains the information about obshell. The obcluster_info section contains the information about OBServer nodes. For more information, see the data structure of ObInfoResp. |
| error | ApiError | The error caused by the request, which contains the following information:
|
The following table describes the data structure of ObInfoResp.
| Section | Parameter | Type | Description |
|---|---|---|---|
| agent_infp | ip | string | The IP address of the OBServer node. |
| port | int | The port number of the OBServer node. | |
| zone | string | The zone to which the OBServer node belongs. | |
| identity | string | The identity of the OBServer node. If the identity of the requested node is SINGLE, only the information about the requested node is returned. Otherwise, the information about all nodes in the cluster is returned. |
|
| version | string | The version of obshell. | |
| obcluster_infp | name | string | The name of the OceanBase cluster. |
| version | string | The version of OceanBase Database. | |
| topology | map[string][]ServerConfig | The topology of the OceanBase cluster. The topology contains all zones in the cluster. ServerConfig contains the information about each OBServer node. For more information, see the data structure of ServerConfig. |
The following table describes the data structure of ServerConfig.
| Parameter | Type | Description |
|---|---|---|
| svr_ip | String | The IP address of the OBServer node. |
| svr_port | Integer | The port number of the OBServer node. |
| sql_port | Integer | The port number for the SQL service protocol of the OBServer node. |
| agent_port | Integer | The port number of the obshell server. |
| with_rootserver | String | Indicates whether the OBServer node is the RootService server of the cluster. |
| status | String | The status of the OBServer node. |
Examples
Sample request
GET 10.10.10.1:2886/api/v1/ob/info
Sample response
The sample response displays the information about all nodes in an initialized OceanBase cluster and the topology information of the cluster. The OceanBase cluster contains two zones, and each zone contains one OBServer node.
{
"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"
}
]
}
}
}
}
References
In addition to using the CLI, you can use SDKs to call the API operation.
For more information about how to call the API operation by using obshell-sdk-python, see Query the information about a cluster.
For more information about how to call the API operation by using obshell-sdk-go, see Query the information about a cluster.