title | summary | aliases | |||
---|---|---|---|---|---|
CLUSTER_HARDWARE |
了解 TiDB 集群硬件表 `CLUSTER_HARDWARE`。 |
|
集群硬件表 CLUSTER_HARDWARE
提供了集群各实例所在服务器的硬件信息。
{{< copyable "sql" >}}
USE information_schema;
DESC cluster_hardware;
+-------------+--------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+------+---------+-------+
| TYPE | varchar(64) | YES | | NULL | |
| INSTANCE | varchar(64) | YES | | NULL | |
| DEVICE_TYPE | varchar(64) | YES | | NULL | |
| DEVICE_NAME | varchar(64) | YES | | NULL | |
| NAME | varchar(256) | YES | | NULL | |
| VALUE | varchar(128) | YES | | NULL | |
+-------------+--------------+------+------+---------+-------+
6 rows in set (0.00 sec)
字段解释:
TYPE
:对应集群信息表information_schema.cluster_info
中的TYPE
字段,可取值为tidb
,pd
和tikv
。INSTANCE
:对应于集群信息表information_schema.cluster_info
中的INSTANCE
字段。DEVICE_TYPE
:硬件类型。目前可以查询的硬件类型有cpu
、memory
、disk
和net
。DEVICE_NAME
:硬件名。对于不同的DEVICE_TYPE
,DEVICE_NAME
的取值不同。cpu
:硬件名为 cpu。memory
:硬件名为 memory。disk
:磁盘名。net
:网卡名。
NAME
:硬件不同的信息名,比如 cpu 有cpu-logical-cores
和cpu-physical-cores
两个信息名,表示逻辑核心数量和物理核心数量。VALUE
:对应硬件信息的值。例如磁盘容量和 CPU 核数。
查询集群 CPU 信息的示例如下:
{{< copyable "sql" >}}
SELECT * FROM cluster_hardware WHERE device_type='cpu' AND device_name='cpu' AND name LIKE '%cores';
+------+-----------------+-------------+-------------+--------------------+-------+
| TYPE | INSTANCE | DEVICE_TYPE | DEVICE_NAME | NAME | VALUE |
+------+-----------------+-------------+-------------+--------------------+-------+
| tidb | 0.0.0.0:4000 | cpu | cpu | cpu-logical-cores | 16 |
| tidb | 0.0.0.0:4000 | cpu | cpu | cpu-physical-cores | 8 |
| pd | 127.0.0.1:2379 | cpu | cpu | cpu-logical-cores | 16 |
| pd | 127.0.0.1:2379 | cpu | cpu | cpu-physical-cores | 8 |
| tikv | 127.0.0.1:20165 | cpu | cpu | cpu-logical-cores | 16 |
| tikv | 127.0.0.1:20165 | cpu | cpu | cpu-physical-cores | 8 |
+------+-----------------+-------------+-------------+--------------------+-------+
6 rows in set (0.03 sec)