如何使用Flink指标

时间:2019-01-17 13:31:01

标签: apache-flink metrics

我有一个具有独立模式的Apache Flink集群,我想配置Flink指标。

flink-conf.yaml中的

config

metrics.reporters: my_jmx_reporter,my_other_reporter

metrics.reporter.my_jmx_reporter.class: org.apache.flink.metrics.jmx.JMXReporter
metrics.reporter.my_jmx_reporter.port: 9020-9040

metrics.reporter.my_other_reporter.class: org.apache.flink.metrics.graphite.GraphiteReporter
metrics.reporter.my_other_reporter.host: 10.0.0.203
metrics.reporter.my_other_reporter.port: 10000

例外

2019-01-17 20:54:25.758 [Flink-MetricRegistry-thread-1] WARN  com.codahale.metrics.graphite.GraphiteReporter  - Unable to report to Graphite
java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at java.net.Socket.connect(Socket.java:538)
        at java.net.Socket.<init>(Socket.java:434)
        at java.net.Socket.<init>(Socket.java:244)
        at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:277)
        at com.codahale.metrics.graphite.Graphite.connect(Graphite.java:128)
        at com.codahale.metrics.graphite.GraphiteReporter.report(GraphiteReporter.java:166)
        at org.apache.flink.dropwizard.ScheduledDropwizardReporter.report(ScheduledDropwizardReporter.java:231)
        at org.apache.flink.runtime.metrics.MetricRegistryImpl$ReporterTask.run(MetricRegistryImpl.java:427)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)

我需要做什么

使用程序在10.0.0.203或其他设备上侦听10000端口

2 个答案:

答案 0 :(得分:2)

是的,您要报告要托管10.0.0.203:10000主机,因此您需要10000上的程序监听端口10.0.0.203。否则,flink无法向其发送消息。在这种情况下,您需要在此主机上启动Graphite。参见doc

答案 1 :(得分:0)

贵公司使用哪种服务作为度量标准服务?那么您应该实施flink度量标准报告程序来报告该服务。 例如,打开猎鹰,opentsdb等。