配置 prometheus、pushgateway 监控 Flink metrics指标

日萌社

人工智能AI:Keras PyTorch MXNet TensorFlow PaddlePaddle 深度学习实战(不定时更新)


 

配置 prometheus、pushgateway 监控 Flink metrics指标

prometheus + pushgateway + grafana 监控 Flink

prometheus + pushgateway + grafana 监控 Flink on Yarn


当prometheus的server与target不在同一网段网络不通,无法直接拉取target数据,需要使用pushgateway作为数据中转点。
flink metric数据流转的流程是 flink metric -> pushgateway -> prometheus。
pushgateway 和 prometheus 都装到同一台机器node1节点上。
Prometheus+PushGateway安装配置
	为什么还要使用PushGateway呢?从上面的图可以发现,Prometheus在正常情况下是采用拉模式从产生metric的作业或者exporter(比如专门监控主机的NodeExporter)拉取监控数据。
	但是我们要监控的是Flink on YARN作业,想要让Prometheus自动发现作业的提交、结束以及自动拉取数据显然是比较困难的。
	PushGateway就是一个中转组件,通过配置Flink on YARN作业将metric推到PushGateway,Prometheus再从PushGateway拉取就可以了。

1.prometheus 和 pushgateway 都是同一个网站下载:https://prometheus.io/download/

2.把 /root/flink/opt (Flink目录下的opt)下的 flink-metrics-prometheus-1.10.1.jar 拷贝一份到 /root/flink/lib(Flink目录下的lib)
	cp /root/flink/opt/flink-metrics-prometheus-1.10.1.jar /root/flink/lib

3.配置 /root/flink/conf/flink-conf.yaml
	官网解释:https://ci.apache.org/projects/flink/flink-docs-release-1.11/zh/monitoring/metrics.html
	flink会把一些metric push到pushgateway的9091端口上,然后prometheus采集。

	vim /root/flink/conf/flink-conf.yaml
		metrics.reporter.promgateway.class: org.apache.flink.metrics.prometheus.PrometheusPushGatewayReporter
		metrics.reporter.promgateway.host: node1
		metrics.reporter.promgateway.port: 9091
		metrics.reporter.promgateway.jobName: myJob
		metrics.reporter.promgateway.randomJobNameSuffix: true
		metrics.reporter.promgateway.deleteOnShutdown: false
		metrics.reporter.promgateway.groupingKey: k1=v1;k2=v2
		metrics.reporter.promgateway.interval: 1 SECONDS

4.配置 prometheus
	tar zxvf prometheus-2.20.0-rc.0.linux-amd64.tar.gz
	mv prometheus-2.20.0-rc.0.linux-amd64 prometheus
	vim /root/prometheus/prometheus.yml

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: ['node1:9090']
  
  - job_name: 'pushgateway'
    scrape_interval: 1s
    static_configs:
    - targets: ['node1:9091']
      labels:
        instance: 'pushgateway'

5.安装 pushgateway
	tar zxvf pushgateway-1.2.0.linux-amd64.tar.gz	
	mv pushgateway-1.2.0.linux-amd64 pushgateway

6.启动 flink集群
	cd /root/flink/bin
	./start-cluster.sh
	./stop-cluster.sh
	http://node1:8081 打开UI界面

7.启动 pushgateway
	cd /root/pushgateway
	./pushgateway &(用了&之后即启动了之后再按一次回车就可以退出打印台)
	http://node1:9091 打开UI界面
	ps aux|grep pushgateway 

8.启动 prometheus 
	cd /root/prometheus
	./prometheus --config.file=prometheus.yml &(用了&之后即启动了之后再按一次回车就可以退出打印台)
	http://node1:9090 打开UI界面
	ps aux|grep prometheus 

 

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

あずにゃん

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值