第05期:使用 prometheus 监控 clickhouse 集群

码界逐光者
• 阅读 3793

第05期:使用 prometheus 监控 clickhouse 集群

一、前言

本文介绍采用 clickhouse-exporter + grafana + prometheus 搭建监控 clickhouse 单节点和集群的监控体系。

二、部署 exporter

获取代码并编译

mkdir -p $GO_PATH/src/github.com/Percona-Lab
cd $GO_PATH/src/github.com/Percona-Lab
git clone https://github.com/Percona-Lab/clickhouse_exporter

因为生产环境的系统是基于 Linux,不能直接访问外网。故在自己的 mac 系统先编译成二进制,然后拷贝到生产环境。

在 mac 上编译 clickhouse_exporter,

再下载到源代码目录。

cd $GO_PATH/src/github.com/Percona-Lab
GO111MODULE=off `CGO_ENABLED`=0 GOOS=linux GOARCH=amd64 go build clickhouse_exporter.go

编译成功会看到二进制文件,

$ ./clickhouse_exporter  -h
Usage of ./clickhouse_exporter:
  -insecure
        Ignore server certificate if using https (default true)
  -log.level value
        Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal, panic].
  -scrape_uri string
        URI to clickhouse http endpoint (default "http://localhost:8123/")
  -telemetry.address string
        Address on which to expose metrics. (default ":9116")
  -telemetry.endpoint string
        Path under which to expose metrics. (default "/metrics")

配置比较简单,就是指定 scrape_uri=clickhouse_server_ip:port, 

启动 exporter,

./clickhouse_exporter -scrape_uri=http://clickhouse_server_ip:8123/ -log.level=info

在 exporter 机器上查看是否能获取到 clickhouse 的数据。
第05期:使用 prometheus 监控 clickhouse 集群

成功。。

三、配置 prometheus

修改 prometheus.yml 文件,targets 指定 clickhouse_exporter 的 ip 地址和端口号,

  - job_name: 'clickhouse_exporter'
    scrape_interval: 10s
    static_configs:
      - targets:
        - "clickhouse_exporter_ip:9116"

修改完配置文件,重新加载,

curl 'http://localhost:9090/-/reload' -X POST

监控多个 clickhouse 节点

当然如果监控多个 clickhouse 集群节点要怎么处理?目前测试的 clickhouse_exporter 还不支持,要重写接受参数的处理逻辑。

或者有知道的朋友怎么操作,可以留言交流。

四、配置 grafna 图形

https://grafana.com/grafana/d... 获取 clickhouse 的监控采集数据模板 ,导入模板,选择 prometheus 数据源,监控展示。
第05期:使用 prometheus 监控 clickhouse 集群

五、小结

本文算是浅显的介绍了利用 clickhouse-exporter + grafana + prometheus 部署 clickhouse 的监控。看了 clickhouse 的性能展示模板还是比较粗糙,如果有需要更细粒度的展示 clickhouse 的集群状态,可以基于监控的 metrics 去配置更丰富的指标。

have fun with ClickHouse  ^_^


关于 ClickHouse 的技术内容,你们还有什么想知道的吗?赶紧留言告诉小编吧!

第05期:使用 prometheus 监控 clickhouse 集群

点赞
收藏
评论区
推荐文章
blmius blmius
4年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
美凌格栋栋酱 美凌格栋栋酱
7个月前
Oracle 分组与拼接字符串同时使用
SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(
梦
4年前
微信小程序new Date()转换时间异常问题
微信小程序苹果手机页面上显示时间异常,安卓机正常问题image(https://imghelloworld.osscnbeijing.aliyuncs.com/imgs/b691e1230e2f15efbd81fe11ef734d4f.png)错误代码vardate'2021030617:00:00'vardateT
Stella981 Stella981
3年前
SpringBoot整合Redis乱码原因及解决方案
问题描述:springboot使用springdataredis存储数据时乱码rediskey/value出现\\xAC\\xED\\x00\\x05t\\x00\\x05问题分析:查看RedisTemplate类!(https://oscimg.oschina.net/oscnet/0a85565fa
Stella981 Stella981
3年前
SpringBoot使用RedisTemplate操作Redis时,key值出现 -xac-xed-x00-x05t-x00-tb
原因分析原因与RedisTemplate源码中的默认序列化方式有关defaultSerializernewJdkSerializationRedisSerializer(classLoader!null?classLoader:this.getClass().getClassLoader()
Wesley13 Wesley13
3年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Easter79 Easter79
3年前
SpringBoot整合Redis乱码原因及解决方案
问题描述:springboot使用springdataredis存储数据时乱码rediskey/value出现\\xAC\\xED\\x00\\x05t\\x00\\x05问题分析:查看RedisTemplate类!(https://oscimg.oschina.net/oscnet/0a85565fa
Easter79 Easter79
3年前
SpringBoot使用RedisTemplate操作Redis时,key值出现 -xac-xed-x00-x05t-x00-tb
原因分析原因与RedisTemplate源码中的默认序列化方式有关defaultSerializernewJdkSerializationRedisSerializer(classLoader!null?classLoader:this.getClass().getClassLoader()
为什么mysql不推荐使用雪花ID作为主键
作者:毛辰飞背景在mysql中设计表的时候,mysql官方推荐不要使用uuid或者不连续不重复的雪花id(long形且唯一),而是推荐连续自增的主键id,官方的推荐是auto_increment,那么为什么不建议采用uuid,使用uuid究
Python进阶者 Python进阶者
1年前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这