Skip to content

Commit 111aca7

Browse files
authored
feat: add cpus memory_bytes and node_status to clusetr_info table (#2111)
1 parent 0e4f9bb commit 111aca7

File tree

2 files changed

+64
-53
lines changed

2 files changed

+64
-53
lines changed

docs/reference/sql/information-schema/cluster-info.md

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,21 @@ DESC TABLE CLUSTER_INFO;
1717
The output is as follows:
1818

1919
```sql
20-
+-------------+----------------------+------+------+---------+---------------+
21-
| Column | Type | Key | Null | Default | Semantic Type |
22-
+-------------+----------------------+------+------+---------+---------------+
23-
| peer_id | Int64 | | NO | | FIELD |
24-
| peer_type | String | | NO | | FIELD |
25-
| peer_addr | String | | YES | | FIELD |
26-
| version | String | | NO | | FIELD |
27-
| git_commit | String | | NO | | FIELD |
28-
| start_time | TimestampMillisecond | | YES | | FIELD |
29-
| uptime | String | | YES | | FIELD |
30-
| active_time | String | | YES | | FIELD |
31-
+-------------+----------------------+------+------+---------+---------------+
20+
+--------------+----------------------+------+------+---------+---------------+
21+
| Column | Type | Key | Null | Default | Semantic Type |
22+
+--------------+----------------------+------+------+---------+---------------+
23+
| peer_id | Int64 | | NO | | FIELD |
24+
| peer_type | String | | NO | | FIELD |
25+
| peer_addr | String | | YES | | FIELD |
26+
| cpus | UInt32 | | NO | | FIELD |
27+
| memory_bytes | UInt64 | | NO | | FIELD |
28+
| version | String | | NO | | FIELD |
29+
| git_commit | String | | NO | | FIELD |
30+
| start_time | TimestampMillisecond | | YES | | FIELD |
31+
| uptime | String | | YES | | FIELD |
32+
| active_time | String | | YES | | FIELD |
33+
| node_status | String | | YES | | FIELD |
34+
+--------------+----------------------+------+------+---------+---------------+
3235
```
3336

3437

@@ -37,11 +40,14 @@ The columns in table:
3740
* `peer_id`: the server id of the node. It's always `0` for standalone mode and `-1` for frontends because it doesn't make sense in such cases.
3841
* `peer_type`: the node type, `METASRV`,`FRONTEND`, or `DATANODE` for distributed clusters and `STANDALONE` for standalone deployments.
3942
* `peer_addr`: the GRPC server address of the node. It's always empty for standalone deployments.
43+
* `cpus`: the number of CPUs of the node.
44+
* `memory_bytes`: the memory size of the node.
4045
* `version`: The build version of the node, such as `0.7.2` etc.
4146
* `git_commit`: The build git commit of the node.
4247
* `start_time`: The node start time.
4348
* `uptime`: The uptime of the node, in the format of duration string `24h 10m 59s 150ms`.
4449
* `active_time`: The duration string in the format of `24h 10m 59s 150ms` since the node's last active time(sending the heartbeats), it's always empty for standalone deployments.
50+
* `node_status`: the status info of the peer.
4551

4652
Query the table:
4753

@@ -52,25 +58,25 @@ SELECT * FROM CLUSTER_INFO;
5258
An example output in standalone deployments:
5359

5460
```sql
55-
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
56-
| peer_id | peer_type | peer_addr | version | git_commit | start_time | uptime | active_time |
57-
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
58-
| 0 | STANDALONE | | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:02.074 | 18ms | |
59-
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
61+
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
62+
| peer_id | peer_type | peer_addr | cpus | memory_bytes | version | git_commit| start_time | uptime | active_time | node_status |
63+
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
64+
| 0 | STANDALONE | | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:02.074 | 18ms | | NULL |
65+
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
6066
```
6167

6268
Another example is from a distributed cluster that has three Datanodes, one Frontend, and one Metasrv.
6369

6470
```sql
65-
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
66-
| peer_id | peer_type | peer_addr | version | git_commit | start_time | uptime | active_time |
67-
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
68-
| 1 | DATANODE | 127.0.0.1:4101 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:04.791 | 4s 478ms | 1s 467ms |
69-
| 2 | DATANODE | 127.0.0.1:4102 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:06.098 | 3s 171ms | 162ms |
70-
| 3 | DATANODE | 127.0.0.1:4103 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:07.425 | 1s 844ms | 1s 839ms |
71-
| -1 | FRONTEND | 127.0.0.1:4001 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:08.815 | 454ms | 47ms |
72-
| 0 | METASRV | 127.0.0.1:3002 | unknown | unknown | | | |
73-
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
71+
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
72+
| peer_id | peer_type | peer_addr | cpus | memory_bytes | version | git_commit| start_time | uptime | active_time | node_status |
73+
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
74+
| 1 | DATANODE | 127.0.0.1:4101 | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:04.791 | 4s 478ms | 1s 467ms | {"workloads":["hybrid"],"leader_regions":46,"follower_regions":0} |
75+
| 2 | DATANODE | 127.0.0.1:4102 | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:06.098 | 3s 171ms | 162ms | {"workloads":["hybrid"],"leader_regions":46,"follower_regions":0} |
76+
| 3 | DATANODE | 127.0.0.1:4103 | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:07.425 | 1s 844ms | 1s 839ms | {"workloads":["hybrid"],"leader_regions":46,"follower_regions":0} |
77+
| -1 | FRONTEND | 127.0.0.1:4001 | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:08.815 | 454ms | 47ms | NULL |
78+
| 0 | METASRV | 127.0.0.1:3002 | 16 | 17179869184 | unknown | unknown | | | | {"is_leader":true} |
79+
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
7480
```
7581

7682

i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/cluster-info.md

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,21 @@ DESC TABLE CLUSTER_INFO;
1717
输出如下:
1818

1919
```sql
20-
+-------------+----------------------+------+------+---------+---------------+
21-
| Column | Type | Key | Null | Default | Semantic Type |
22-
+-------------+----------------------+------+------+---------+---------------+
23-
| peer_id | Int64 | | NO | | FIELD |
24-
| peer_type | String | | NO | | FIELD |
25-
| peer_addr | String | | YES | | FIELD |
26-
| version | String | | NO | | FIELD |
27-
| git_commit | String | | NO | | FIELD |
28-
| start_time | TimestampMillisecond | | YES | | FIELD |
29-
| uptime | String | | YES | | FIELD |
30-
| active_time | String | | YES | | FIELD |
31-
+-------------+----------------------+------+------+---------+---------------+
20+
+--------------+----------------------+------+------+---------+---------------+
21+
| Column | Type | Key | Null | Default | Semantic Type |
22+
+--------------+----------------------+------+------+---------+---------------+
23+
| peer_id | Int64 | | NO | | FIELD |
24+
| peer_type | String | | NO | | FIELD |
25+
| peer_addr | String | | YES | | FIELD |
26+
| cpus | UInt32 | | NO | | FIELD |
27+
| memory_bytes | UInt64 | | NO | | FIELD |
28+
| version | String | | NO | | FIELD |
29+
| git_commit | String | | NO | | FIELD |
30+
| start_time | TimestampMillisecond | | YES | | FIELD |
31+
| uptime | String | | YES | | FIELD |
32+
| active_time | String | | YES | | FIELD |
33+
| node_status | String | | YES | | FIELD |
34+
+--------------+----------------------+------+------+---------+---------------+
3235
```
3336

3437

@@ -37,12 +40,14 @@ DESC TABLE CLUSTER_INFO;
3740
* `peer_id`: 节点的服务器 ID。对于 standalone 来讲,该字段总是为 `0`,对于集群模式下的 frontend 该字段总为 `-1`。因为在这两种情况下,该字段没有实际含义。
3841
* `peer_type`: 节点类型,分布式集群里可能是 `METASRV``FRONTEND` 或者 `DATANODE`。单机模式显示为 `STANDALONE`
3942
* `peer_addr`: 节点的 gRPC 服务地址。对于单机部署,该字段总为空。
43+
* `cpus`: 节点的 CPU 数量。
44+
* `memory_bytes`: 节点的内存大小。
4045
* `version`: 节点的版本号,形如 `0.7.2` 的字符串。
4146
* `git_commit`: 节点编译的 git 版本号。
4247
* `start_time`: 节点的启动时间。
4348
* `uptime`: 节点的持续运行时间,形如 `24h 10m 59s 150ms` 的字符串。
4449
* `active_time`: 距离节点上一次活跃(也就是发送心跳请求)过去的时间,形如 `24h 10m 59s 150ms` 的字符串。单机模式下该字段总为空。
45-
50+
* `node_status`: 节点的状态信息。
4651

4752
尝试查询下这张表:
4853

@@ -53,25 +58,25 @@ SELECT * FROM CLUSTER_INFO;
5358
一个单机模式的样例输出:
5459

5560
```sql
56-
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
57-
| peer_id | peer_type | peer_addr | version | git_commit | start_time | uptime | active_time |
58-
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
59-
| 0 | STANDALONE | | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:02.074 | 18ms | |
60-
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
61+
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
62+
| peer_id | peer_type | peer_addr | cpus | memory_bytes | version | git_commit| start_time | uptime | active_time | node_status |
63+
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
64+
| 0 | STANDALONE | | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:02.074 | 18ms | | NULL |
65+
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
6166
```
6267

6368
另一个输出来自一个分布式集群,它有三个 Datanode、一个 Frontend 和一个 Metasrv:
6469

6570
```sql
66-
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
67-
| peer_id | peer_type | peer_addr | version | git_commit | start_time | uptime | active_time |
68-
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
69-
| 1 | DATANODE | 127.0.0.1:4101 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:04.791 | 4s 478ms | 1s 467ms |
70-
| 2 | DATANODE | 127.0.0.1:4102 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:06.098 | 3s 171ms | 162ms |
71-
| 3 | DATANODE | 127.0.0.1:4103 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:07.425 | 1s 844ms | 1s 839ms |
72-
| -1 | FRONTEND | 127.0.0.1:4001 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:08.815 | 454ms | 47ms |
73-
| 0 | METASRV | 127.0.0.1:3002 | unknown | unknown | | | |
74-
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
71+
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
72+
| peer_id | peer_type | peer_addr | cpus | memory_bytes | version | git_commit| start_time | uptime | active_time | node_status |
73+
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
74+
| 1 | DATANODE | 127.0.0.1:4101 | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:04.791 | 4s 478ms | 1s 467ms | {"workloads":["hybrid"],"leader_regions":46,"follower_regions":0} |
75+
| 2 | DATANODE | 127.0.0.1:4102 | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:06.098 | 3s 171ms | 162ms | {"workloads":["hybrid"],"leader_regions":46,"follower_regions":0} |
76+
| 3 | DATANODE | 127.0.0.1:4103 | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:07.425 | 1s 844ms | 1s 839ms | {"workloads":["hybrid"],"leader_regions":46,"follower_regions":0} |
77+
| -1 | FRONTEND | 127.0.0.1:4001 | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:08.815 | 454ms | 47ms | NULL |
78+
| 0 | METASRV | 127.0.0.1:3002 | 16 | 17179869184 | unknown | unknown | | | | {"is_leader":true} |
79+
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
7580
```
7681

7782

0 commit comments

Comments
 (0)