CLUSTER_HARDWARE
The CLUSTER_HARDWARE
hardware system table provides the hardware information of the server where each instance of the cluster is located.
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)
Field description:
TYPE
: Corresponds to theTYPE
field in theinformation_schema.cluster_info
table. The optional values aretidb
,pd
, andtikv
.INSTANCE
: Corresponds to theINSTANCE
field in theinformation_schema.cluster_info
cluster information table.DEVICE_TYPE
: Hardware type. Currently, you can query thecpu
,memory
,disk
, andnet
types.DEVICE_NAME
: Hardware name. The value ofDEVICE_NAME
varies withDEVICE_TYPE
.cpu
: The hardware name is cpu.memory
: The hardware name is memory.disk
: The disk name.net
: The network card name.
NAME
: The different information names of the hardware. For example, cpu has two information names:cpu-logical-cores
andcpu-physical-cores
, which respectively mean logical core numbers and physical core numbers.VALUE
: The value of the corresponding hardware information, such as the disk volume and CPU core numbers.
The following example shows how to query the CPU information using the CLUSTER_HARDWARE
table:
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)