hbase Problem binding to node1/192.168.1.13:16020 : 地址已在使用

时间:2022-10-17 12:14:10

  这是hbase 从0.9.x升级到1.x后HMaster与HRegionServer端口冲突问题

  

  在hbase升级到1.0.0版本后,默认端口做了改动。其中16020端口是hmaster服务和hregionserver服务各自使用的默认端口,导致端口冲突。

  官方文档相关信息如下 
  The HMaster server controls the HBase cluster. You can start up to 9 backup HMaster servers, which makes 10 total HMasters, counting the primary. To start a backup HMaster, use the local-master-backup.sh. For each backup   master you want to start, add a parameter representing the port offset for that master. Each HMaster uses three ports (16010, 16020, and 16030 by default). The port offset is added to these ports, so using an offset of 2, the   backup HMaster would use ports 16012, 16022, and 16032. The following command starts 3 backup servers using ports 16012/16022/16032, 16013/16023/16033, and 16015/16025/16035.

  The HRegionServer manages the data in its StoreFiles as directed by the HMaster. Generally, one HRegionServer runs per node in the cluster. Running multiple HRegionServers on the same system can be useful for testing in

  pseudo-distributed mode. The local-regionservers.sh command allows you to run multiple RegionServers. It works in a similar way to the local-master-backup.sh command, in that each parameter you provide represents the port offset for an instance. Each RegionServer requires two ports, and the default ports are 16020 and 16030. However, the base ports for additional RegionServers are not the default ports since the default ports are used by the HMaster, which is also a RegionServer since HBase version 1.0.0. The base ports are 16200 and 16300 instead. You can run 99 additional RegionServers that are not a HMaster or backup HMaster, on a server. The following command starts four additional RegionServers, running on sequential ports starting at 16202/16302 (base ports 16200/16300 plus 2).

  解决方法: 
  按理说不使用默认配置,定义自己的端口配置就可以解决该问题

   <property>
<name>hbase.master.port</name>
<value>16000</value>
</property>
<property>
<name>hbase.master.info.port</name>
<value>16010</value>
</property>
<property>
<name>hbase.regionserver.port</name>
<value>16201</value>
</property>
<property>
<name>hbase.regionserver.info.port</name>
<value>16301</value>
</property>

  但是实际上 使用start-hbase.sh 脚本启动regionserver还是会报端口冲突问题,可能通过这个脚本启动程序存在问题。没有深究看源码。 
  该问题可以通过 使用单独的regionserver启动脚本程序启动regionserver来规避。 
  使用方法:

bin/local-regionservers.sh start 1

  部分转载自:http://blog.csdn.net/xishanxinyue/article/details/45874063