带jmx导出器的hbase异常

bq8i3lrv  于 2021-06-09  发布在  Hbase
关注(0)|答案(1)|浏览(553)

我在ambari hdp上部署了hbase。我尝试使用jmx exporter获取hbase指标,因此在“hbase env”中添加下一个配置: export HBASE_OPTS="$HBASE_OPTS -javaagent:/opt/jmx_exporter/jmx_exporter_javaagent.jar=7174:/opt/jmx_exporter/hbase/hbase.yml" 我运行hbase没有问题,但是当我尝试访问hbase shell时,它会抛出下一个错误:

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:497)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent (InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain (InstrumentationImpl.java:401)
Caused by: java.net.BindException: The address is already being used
at sun.nio.ch.Net.bind0 (Native Method)
at sun.nio.ch.Net.bind (Net.java:437)
at sun.nio.ch.Net.bind (Net.java:429)
at sun.nio.ch.ServerSocketChannelImpl.bind (ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind (ServerSocketAdaptor.java:74)
at sun.net.httpserver.ServerImpl.bind (ServerImpl.java:133)
at sun.net.httpserver.HttpServerImpl.bind (HttpServerImpl.java:54)
at io.prometheus.jmx.shaded.io.prometheus.client.exporter.HTTPServer. <init> (HTTPServer.java:145)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain (JavaAgent.java:49)
... 6 more
FATAL ERROR in native method: processing of -javaagent failed
Aborted

我已经尝试更改jmx导出器的端口,但总是抛出异常。如果我在hbase env中删除jmx exporter的行,它工作正常,我可以访问hbase shell。

4xrmg8kj

4xrmg8kj1#

根据下一篇文章:https://blog.godatadriven.com/hbase-prometheus-monitoring,我在/usr/bin/hbase中添加了以下内容,因此如果端口可用,它将只在第一次导出度量。

if [ `lsof -n -i:7000 | grep LISTEN | wc -l` == "0" ]; then
  export HBASE_OPTS="$HBASE_OPTS -javaagent:/opt/jmx_exporter/jmx_exporter_javaagent.jar=7000:/opt/jmx_exporter/hbase/hbase.yml"
fi

问题是,每次尝试启动hbase的服务时,都会出现端口冲突,因此失败。

相关问题