Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 32 additions & 26 deletions docs/reference/sql/information-schema/cluster-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ DESC TABLE CLUSTER_INFO;
The output is as follows:

```sql
+-------------+----------------------+------+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+-------------+----------------------+------+------+---------+---------------+
| peer_id | Int64 | | NO | | FIELD |
| peer_type | String | | NO | | FIELD |
| peer_addr | String | | YES | | FIELD |
| version | String | | NO | | FIELD |
| git_commit | String | | NO | | FIELD |
| start_time | TimestampMillisecond | | YES | | FIELD |
| uptime | String | | YES | | FIELD |
| active_time | String | | YES | | FIELD |
+-------------+----------------------+------+------+---------+---------------+
+--------------+----------------------+------+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------------+----------------------+------+------+---------+---------------+
| peer_id | Int64 | | NO | | FIELD |
| peer_type | String | | NO | | FIELD |
| peer_addr | String | | YES | | FIELD |
| cpus | UInt32 | | NO | | FIELD |
| memory_bytes | UInt64 | | NO | | FIELD |
| version | String | | NO | | FIELD |
| git_commit | String | | NO | | FIELD |
| start_time | TimestampMillisecond | | YES | | FIELD |
| uptime | String | | YES | | FIELD |
| active_time | String | | YES | | FIELD |
| node_status | String | | YES | | FIELD |
+--------------+----------------------+------+------+---------+---------------+
```


Expand All @@ -37,11 +40,14 @@ The columns in table:
* `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.
* `peer_type`: the node type, `METASRV`,`FRONTEND`, or `DATANODE` for distributed clusters and `STANDALONE` for standalone deployments.
* `peer_addr`: the GRPC server address of the node. It's always empty for standalone deployments.
* `cpus`: the number of CPUs of the node.
* `memory_bytes`: the memory size of the node.
* `version`: The build version of the node, such as `0.7.2` etc.
* `git_commit`: The build git commit of the node.
* `start_time`: The node start time.
* `uptime`: The uptime of the node, in the format of duration string `24h 10m 59s 150ms`.
* `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.
* `node_status`: the status info of the peer.

Query the table:

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

```sql
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
| peer_id | peer_type | peer_addr | version | git_commit | start_time | uptime | active_time |
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
| 0 | STANDALONE | | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:02.074 | 18ms | |
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
| peer_id | peer_type | peer_addr | cpus | memory_bytes | version | git_commit| start_time | uptime | active_time | node_status |
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
| 0 | STANDALONE | | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:02.074 | 18ms | | NULL |
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
```

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

```sql
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
| peer_id | peer_type | peer_addr | version | git_commit | start_time | uptime | active_time |
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
| 1 | DATANODE | 127.0.0.1:4101 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:04.791 | 4s 478ms | 1s 467ms |
| 2 | DATANODE | 127.0.0.1:4102 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:06.098 | 3s 171ms | 162ms |
| 3 | DATANODE | 127.0.0.1:4103 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:07.425 | 1s 844ms | 1s 839ms |
| -1 | FRONTEND | 127.0.0.1:4001 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:08.815 | 454ms | 47ms |
| 0 | METASRV | 127.0.0.1:3002 | unknown | unknown | | | |
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
| peer_id | peer_type | peer_addr | cpus | memory_bytes | version | git_commit| start_time | uptime | active_time | node_status |
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
| 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} |
| 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} |
| 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} |
| -1 | FRONTEND | 127.0.0.1:4001 | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:08.815 | 454ms | 47ms | NULL |
| 0 | METASRV | 127.0.0.1:3002 | 16 | 17179869184 | unknown | unknown | | | | {"is_leader":true} |
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
```


Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ DESC TABLE CLUSTER_INFO;
输出如下:

```sql
+-------------+----------------------+------+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+-------------+----------------------+------+------+---------+---------------+
| peer_id | Int64 | | NO | | FIELD |
| peer_type | String | | NO | | FIELD |
| peer_addr | String | | YES | | FIELD |
| version | String | | NO | | FIELD |
| git_commit | String | | NO | | FIELD |
| start_time | TimestampMillisecond | | YES | | FIELD |
| uptime | String | | YES | | FIELD |
| active_time | String | | YES | | FIELD |
+-------------+----------------------+------+------+---------+---------------+
+--------------+----------------------+------+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------------+----------------------+------+------+---------+---------------+
| peer_id | Int64 | | NO | | FIELD |
| peer_type | String | | NO | | FIELD |
| peer_addr | String | | YES | | FIELD |
| cpus | UInt32 | | NO | | FIELD |
| memory_bytes | UInt64 | | NO | | FIELD |
| version | String | | NO | | FIELD |
| git_commit | String | | NO | | FIELD |
| start_time | TimestampMillisecond | | YES | | FIELD |
| uptime | String | | YES | | FIELD |
| active_time | String | | YES | | FIELD |
| node_status | String | | YES | | FIELD |
+--------------+----------------------+------+------+---------+---------------+
```


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

* `node_status`: 节点的状态信息。

尝试查询下这张表:

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

```sql
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
| peer_id | peer_type | peer_addr | version | git_commit | start_time | uptime | active_time |
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
| 0 | STANDALONE | | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:02.074 | 18ms | |
+---------+------------+-----------+---------+------------+-------------------------+--------+-------------+
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
| peer_id | peer_type | peer_addr | cpus | memory_bytes | version | git_commit| start_time | uptime | active_time | node_status |
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
| 0 | STANDALONE | | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:02.074 | 18ms | | NULL |
+---------+------------+-----------+------+--------------+---------+-----------+----------------------------+--------+-------------+-------------+
```

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

```sql
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
| peer_id | peer_type | peer_addr | version | git_commit | start_time | uptime | active_time |
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
| 1 | DATANODE | 127.0.0.1:4101 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:04.791 | 4s 478ms | 1s 467ms |
| 2 | DATANODE | 127.0.0.1:4102 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:06.098 | 3s 171ms | 162ms |
| 3 | DATANODE | 127.0.0.1:4103 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:07.425 | 1s 844ms | 1s 839ms |
| -1 | FRONTEND | 127.0.0.1:4001 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:08.815 | 454ms | 47ms |
| 0 | METASRV | 127.0.0.1:3002 | unknown | unknown | | | |
+---------+-----------+----------------+---------+------------+-------------------------+----------+-------------+
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
| peer_id | peer_type | peer_addr | cpus | memory_bytes | version | git_commit| start_time | uptime | active_time | node_status |
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
| 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} |
| 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} |
| 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} |
| -1 | FRONTEND | 127.0.0.1:4001 | 16 | 17179869184 | 0.7.2 | 86ab3d9 | 2024-04-30T06:40:08.815 | 454ms | 47ms | NULL |
| 0 | METASRV | 127.0.0.1:3002 | 16 | 17179869184 | unknown | unknown | | | | {"is_leader":true} |
+---------+-----------+----------------+------+--------------+---------+-----------+----------------------------+----------+-------------+-------------------------------------------------------------------+
```