原文链接:
Monitoring | ClickHouse Docshttps://clickhouse.com/docs/en/operations/monitoring
目录
clickhouse推荐监控两大项:
- clickhouse运行的硬件资源的利用率
- clickhouse服务的各项记录指标
对于硬件资源利用率。
clickhouse官网的意思,本身不会去监控硬件资源的状态,监控硬件需要第三方工具。
clickhouse建议监控硬件项中的磁盘存储,RAM和网络使用率。
对于clickhouse本身指标。
如果想要跟踪clickhouse中发生的事件,可以通过ck的日志来查看,相关的连接:Server Settings | ClickHouse Docs
clickhouse的原生监控项,主要会监控两方面:
- 服务端用于计算的各项资源指标
- 查询处理的常见统计信息
ck的所有监控指标都可以通过系统表来查询。
三张系统表
- 系统表用于实现系统的部分功能,并提供对有关系统如何工作的信息的访问。
- 不能删除系统表(但可以执行DETACH)。
- 系统表在磁盘上没有数据或元数据的文件。服务器在启动时创建所有系统表。
- 系统表是只读的。
- 它们位于‘system'数据库中。
system.mertics
包含具有当前值或者可以立即计算的一些指标。该表中的数据一直是最新的。
比如当前同时处理的查询数,当前副本的延迟等等。
表中包含三列值:
在 src/Common/CurrentMetrics.cpp 中列出的监控项,想看当前版本支持的监控项,可以直接ck上使用 select * from system.metrics \G
下面是21.8版本上的监控项,分组非官方,仅供参考
大略分组 | 监控项名称 | 监控项含义 |
---|---|---|
Query | Number of executing queries 正在执行的查询数量 |
|
Merge | Number of executing background merges 正在执行的合并任务 |
|
PartMutation | Number of mutations (ALTER DELETE/UPDATE) 突变数量(不是发生的突变次数) |
|
副本相关 | ReplicatedFetch | Number of data parts being fetched from replica 从副本获取的part数量 |
ReplicatedSend | Number of data parts being sent to replicas 发送给副本的part数量 |
|
ReplicatedChecks | Number of data parts checking for consistency 正在检查一致性的part数量 |
|
后端任务 | BackgroundPoolTask | Number of active tasks in BackgroundProcessingPool (merges, mutations, or replication queue bookkeeping) 后台正在执行的任务数量,比如merge任务,突变之类的 |
BackgroundFetchesPoolTask | Number of active tasks in BackgroundFetchesPool |
|
BackgroundMovePoolTask | Number of active tasks in BackgroundProcessingPool for moves | |
BackgroundSchedulePoolTask | Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. | |
BackgroundBufferFlushSchedulePoolTask | Number of active tasks in BackgroundBufferFlushSchedulePool. This pool is used for periodic Buffer flushes | |
BackgroundDistributedSchedulePoolTask | Number of active tasks in BackgroundDistributedSchedulePool. This pool is used for distributed sends that is done in background. | |
BackgroundMessageBrokerSchedulePoolTask | Number of active tasks in BackgroundProcessingPool for message streaming | |
CacheDictionaryUpdateQueueBatches | Number of 'batches' (a set of keys) in update queue in CacheDictionaries. | |
CacheDictionaryUpdateQueueKeys | Exact number of keys in update queue in CacheDictionaries. | |
DiskSpaceReservedForMerge | Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. 为当前运行的后台合并保留的磁盘空间。 它略大于当前合并部分的总大小。 |
|
QueryPreempted | Number of queries that are stopped and waiting due to 'priority' setting. 由于“优先级”设置而停止和等待的查询数。 |
|
客户端连接数量 | TCPConnection | Number of connections to TCP server (clients with native interface), also included server-server di |