flink不向graphite发送度量

g0czyy6m  于 2021-06-25  发布在  Flink
关注(0)|答案(1)|浏览(387)

我有两个ApacheFlink集群:1.1.3用于生产,1.3.2用于暂存。
我对向graphite服务器发送度量很感兴趣,因此我按照中的说明进行了设置https://ci.apache.org/projects/flink/flink-docs-release-1.3/monitoring/metrics.html.
我让它在我的1.1.3集群中工作,但在1.3.2中没有。我添加到flink lib目录的jar文件是:
在1.1.3中:
http://central.maven.org/maven2/io/dropwizard/metrics/metrics-graphite/3.1.0/metrics-graphite-3.1.0.jar
http://central.maven.org/maven2/org/apache/flink/flink-metrics-dropwizard/1.1.1-hadoop1/flink-metrics-dropwizard-1.1.1-hadoop1.jar
http://central.maven.org/maven2/org/apache/flink/flink-metrics-graphite/1.1.4/flink-metrics-graphite-1.1.4.jar
http://central.maven.org/maven2/org/apache/flink/flink-metrics-jmx/1.1.4/flink-metrics-jmx-1.1.4.jar
在1.3.2中:
http://central.maven.org/maven2/io/dropwizard/metrics/metrics-graphite/3.1.0/metrics-graphite-3.1.0.jar
http://central.maven.org/maven2/org/apache/flink/flink-metrics-dropwizard/1.1.1-hadoop1/flink-metrics-dropwizard-1.1.1-hadoop1.jar
http://central.maven.org/maven2/org/apache/flink/flink-metrics-graphite/1.3.2/flink-metrics-graphite-1.3.2.jar
http://central.maven.org/maven2/org/apache/flink/flink-metrics-jmx/1.3.2/flink-metrics-jmx-1.3.2.jar
我在这两个服务器上添加的设置是相同的(除了它们发送到不同的graphite服务器):

metrics.reporters: grph
metrics.reporter.grph.class: org.apache.flink.metrics.graphite.GraphiteReporter
metrics.reporter.grph.host: 10.x.x.x
metrics.reporter.grph.port: 2003
metrics.reporter.grph.prefix: flink
metrics.reporter.grph.protocol: TCP

我在临时集群(1.3.2)上看到的错误消息是:

java.lang.NoClassDefFoundError: com/codahale/metrics/Reporter
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.flink.runtime.metrics.MetricRegistry.<init>(MetricRegistry.java:123)
    at org.apache.flink.runtime.taskexecutor.TaskManagerServices.fromConfiguration(TaskManagerServices.java:188)
    at org.apache.flink.runtime.taskmanager.TaskManager$.startTaskManagerComponentsAndActor(TaskManager.scala:1921)
    at org.apache.flink.runtime.taskmanager.TaskManager$.runTaskManager(TaskManager.scala:1819)
    at org.apache.flink.runtime.taskmanager.TaskManager$.selectNetworkInterfaceAndRunTaskManager(TaskManager.scala:1673)
    at org.apache.flink.runtime.taskmanager.TaskManager$$anon$2.call(TaskManager.scala:1574)
    at org.apache.flink.runtime.taskmanager.TaskManager$$anon$2.call(TaskManager.scala:1572)
    at org.apache.flink.runtime.security.HadoopSecurityContext$1.run(HadoopSecurityContext.java:43)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
    at org.apache.flink.runtime.security.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:40)
    at org.apache.flink.runtime.taskmanager.TaskManager$.main(TaskManager.scala:1572)
    at org.apache.flink.runtime.taskmanager.TaskManager.main(TaskManager.scala)
Caused by: java.lang.ClassNotFoundException: com.codahale.metrics.Reporter
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 40 common frames omitted

任何帮助都将不胜感激!

eni9jsuy

eni9jsuy1#

您必须添加io.dropwizard。metrics:metrics-core 3.1.0 到/lib文件夹。原因是在1.1中,flink运行时本身使用的是metrics核心,而在1.3中就不再是这样了。
或者,您也可以使用flink metrics graphite jar和依赖项,这些依赖项应该包含您需要的所有内容。

相关问题