Canal server 性能指标监控基于prometheus的实现
下面来介绍具体搭建教程
官方下载速度较慢,推荐使用csdn下载本教程使用安装文件
https://download.csdn.net/download/heaven_monkey/12344124
一、安装部署prometheus
1、下载prometheus
Prometheus的官方下载地址为 https://prometheus.io/download/
wget https://github.com/prometheus/prometheus/releases/download/v2.17.1/prometheus-2.17.1.linux-amd64.tar.gz
tar -zxvf prometheus-2.17.1.linux-amd64.tar.gz
cd prometheus-2.17.1.linux-amd64
2、配置prometheus.yml,添加canal的job,
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: 'canal'
static_configs:
- targets: ['127.0.0.1:8112','10.0.0.1:8112']
//端口配置即为canal.properties中的canal.metrics.pull.port
3、启动prometheus与canal server
通常启动方式如下:
./prometheus
如果要修改端口则通过一下方式,可以指定web访问端口
./prometheus --config.file=prometheus.yml --web.listen-address=:8291 &
canal启动就不在此详细描述
此时可以通过Prometheus自带的UI页面进行访问查看
http://127.0.0.1:8291/graph
二、安装与部署Grafana
1、下载Grafana
wget https://dl.grafana.com/oss/release/grafana-5.3.4.linux-amd64.tar.gz
tar -zxvf grafana-5.3.4.linux-amd64.tar.gz
cd grafana-5.3.4
可以编辑conf/defaults.ini 对web端口进行修改
# The http port to use
http_port = 8299
2、启动Grafana
./bin/grafana-server web &
3、访问Grafana
用户名密码:admin/admin
登录之后会看到
添加数据源
save & test 提示add 成功
选择导入 dashboard
canal官方提供的导入模板 导入模板
导入后就可以查看到canal相关指标信息
因为canal使用了kafka模式,这里没有client相关监控指标