问题描述:

通过 bin/start-hbase.sh无法开启HRegionServer,查看了日志发现如下错误:

ava.lang.RuntimeException: Failed construction of Regionserver: class org.apache.hadoop.hbase.regionserver.HRegionServer
        at org.apache.hadoop.hbase.regionserver.HRegionServer.constructRegionServer(HRegionServer.java:2706)
        at org.apache.hadoop.hbase.regionserver.HRegionServerCommandLine.start(HRegionServerCommandLine.java:64)
        at org.apache.hadoop.hbase.regionserver.HRegionServerCommandLine.run(HRegionServerCommandLine.java:87)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
        at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:126)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.main(HRegionServer.java:2721)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.constructRegionServer(HRegionServer.java:2704)
        ... 5 more
Caused by: java.io.IOException: Problem binding to hadoop02/192.168.10.102:16020 : 地址已在使用. To switch ports use the 'hbase.regionserver.port' configuration property.
        at org.apache.hadoop.hbase.regionserver.RSRpcServices.<init>(RSRpcServices.java:1002)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.createRpcServices(HRegionServer.java:667)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.<init>(HRegionServer.java:543)
        ... 10 more
Caused by: java.net.BindException: 地址已在使用
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.apache.hadoop.hbase.ipc.RpcServer.bind(RpcServer.java:2742)
        at org.apache.hadoop.hbase.ipc.RpcServer$Listener.<init>(RpcServer.java:661)
        at org.apache.hadoop.hbase.ipc.RpcServer.<init>(RpcServer.java:2178)
        at org.apache.hadoop.hbase.regionserver.RSRpcServices.<init>(RSRpcServices.java:994)
        ... 12 more

分析

运行时异常,class org.apache.hadoop.hbase.regionserver.HRegionServer,查看了一圈网上的解决方案没解决。下面pull上找到解决方法,可这个路径一开始就弄好了。

  • 把hadoop的hdfs-site.xml和core-site.xml 放到hbase/conf下
    因此关闭一下hbase:bin/stop-hbase.sh单独开启HMaster和HRegionServer
bin/hbase-daemon.sh start master
bin/hbase-daemon.sh start regionserver

可以正常启动,查看日志也没问题。

解决

这时候看到conf文件下regionservers,将localhost删除,停止bin/stop-hbase.sh后。再次start就正常启动了。

3568 QuorumPeerMain
10736 HRegionServer
10527 HMaster
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐