在EMR上运行的Jmxtrans与JMX显示错误“连接被拒绝”

时间:2019-07-04 13:59:15

标签: jmx jmxtrans

Jmxtrans用于获取与flink作业相关的指标,在​​jmxtrans日志文件中显示以下错误:

ERROR (com.googlecode.jmxtrans.jmx.ProcessQueryThread:57) - Error executing query Query(objectName=kafka.consumer:type=consumer-fetch-manager- metrics,client-id=consumer-6,topic=test_flink, keys=[], attr=[records- consumed-rate, fetch-latency-avg], typeNames=[], resultAlias=Flink_Consumer, useObjDomainAsKey=false, allowDottedKeys=false, useAllTypeNames=false, outputWriterInstances=[com.googlecode.jmxtrans.model.output.support.ResultTransformerOutputWriter@13f94c67]) on server Server(pid=null, host=localhost, port=9010, url=service:jmx:rmi:///jndi/rmi://localhost:9010/jmxrmi, cronExpression=null, numQueryThreads=0)
    java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
    java.net.ConnectException: Connection refused (Connection refused)]
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:369)
    at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:270)
    at com.googlecode.jmxtrans.model.Server.getServerConnection(Server.java:342)
    at com.googlecode.jmxtrans.connections.MBeanServerConnectionFactory.makeObject(MBeanServerConnectionFactory.java:38)
    at com.googlecode.jmxtrans.connections.MBeanServerConnectionFactory.makeObject(MBeanServerConnectionFactory.java:31)
    at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1220)
    at com.googlecode.jmxtrans.model.Server.execute(Server.java:273)
    at com.googlecode.jmxtrans.jmx.ProcessQueryThread.run(ProcessQueryThread.java:54)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
    java.net.ConnectException: Connection refused (Connection refused)]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:136)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:205)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1955)
    at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1922)
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:287)
    ... 12 more
    Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
    java.net.ConnectException: Connection refused (Connection refused)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:338)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:112)
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:132)
    ... 17 more
    Caused by: 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:211)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
    ... 22 more


Flink job running on EMR uses jmx to report the metrics,Configured the flink-conf.yaml with below details:
metrics.reporters: jmx
metrics.reporter.jmx.class: org.apache.flink.metrics.jmx.JMXReporter
metrics.reporter.jmx.port: Portno(ex: 9010)

尝试使用以下参数运行flink作业: flink运行kafka_flink_cons.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port = 9010 -Dcom.sun.management.jmxremote.local.only = false -Dcom.sun.management.jmxremote.authenticate = false -Dcom.sun.management.jmxremote.ssl = false

参考:Why am I getting the error "connection refused" with JMX

已配置config.json文件,以写入从jconsole中的指标mbean提取的指标,以使用屏幕快照https://i.stack.imgur.com/kPnkp.png

中显示的cloudwatch writer写入cloudwatch。

0 个答案:

没有答案