我已经在Ambari HDP上部署了HBase。我尝试使用JMX导出器获取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导出器的端口,但是始终抛出BindException。如果我在Hbase-env中删除JMX导出器的行,则它可以正常工作,并且可以访问hbase shell。
答案 0 :(得分:0)
基于下一篇文章: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服务时,都会发生端口冲突,因此失败。
答案 1 :(得分:0)
我也一样。即使我将以下代码放在 /bin/hbase 中,我仍然收到此错误:
[root@xxx ~]# hbase shell 检查端口 7000 - 未使用端口 7000 - 使用端口 7000 用法:-javaagent:/path/to/JavaAgent.jar=[host:]:收集器已经注册,提供名称:jmx_exporter_build_info
用于 {7000..8010} 中的端口;做
if [ `lsof -n -i:$port | grep LISTEN | wc -l` == "1" ]; then
echo "Checking port $port - port $port in use"
else
echo "Checking port $port - port $port not in use - using port $port"
export HBASE_OPTS="$HBASE_OPTS -javaagent:/hdptmp/jmx_prometheus_javaagent-0.16.0.jar=$port:/hdptmp/hbase_jmx_config.yaml"
break
fi
完成