Not able to connect to remote Hbase

不打扰是莪最后的温柔 提交于 2019-12-24 12:57:13

问题


i have a Hbase installation in distributed mode. The database is working fine and I am able to connect to the database if my webapp(spring + datanucleus JDO) is deployed on the same machine as the Hbase master.

But if I run the same webapp on a different machine I am not able to connect to the HBase server. There are no exceptions at all and the webapp just stalls and after a few minutes times out. My config files are as follows:

hbase-site.xml ->

<configuration>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value><IP>:2181</value>
    <description>The host and port that the HBase master runs at.
    </description>
  </property>
</configuration>

datanucleus.properties ->

javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.api.jdo.JDOPersistenceManagerFactory
javax.jdo.option.ConnectionURL=hbase:
datanucleus.autoCreateSchema=true
datanucleus.autoCreateTables=true
datanucleus.autoCreateColumns=true
datanucleus.cache.level2.type=none

What am I doing wrong here. And also what all ports should be accessible to the client machines (as in production we open only required ports).

Thanks


回答1:


The HBase is very sensitive to /etc/hosts configurations.. I had to set the zeekeeper bindings property in the hbase-site.xml correctly in order for the above mentioned Java code to work...For example: I had to set it as follows:

{property}
  {name}hbase.zookeeper.quorum{/name}
  {value}www.remoterg12.net{/value}      {!-- this is the externally accessible domain --}
{/property}
{property}
  {name}hbase.zookeeper.property.clientPort{/name}
  {value}2181{/value}              {!-- everything needs to be externally accessible --}
{/property}
{property}
  {name}hbase.master.info.port{/name}    {!--   http://www.remoterg12.net:60010/ --}
  {value}60010{/value}
{/property}
{property}
  {name}hbase.master.info.bindAddress{/name}
  {value}www.remoterg12.net{/value}      {!-- Use this to access the GUI console, --}
{/property}

The Remote GUI will give you a clear picture of the Binding Domains.. For example, the [HBase Master] property in the "GUI Web console" should be something like this: www.remoterg12.net:60010 (It should NOT be localhost:60010 )... AND YES!!, I did have to play around with the /etc/hosts just right as I didn't want to mess up the existing Apache configs :-)




回答2:


One surprising thing that people sometimes don't think about: often most of a cluster is hidden behind a switch. This is often the case if all of your machine ip addresses are 198...*. If the machine you are trying to access the cluster from is not in the same network, you will not be able to use hbase. This is because your hbase connections are direct from the client to the node hosting the data. They do not go through the dual-homed node that you are accustomed to log into.

I don't know of a good work around, other than to put your application on the dual-homed node that can see the rest of the world. Or to set up some sort of gateway on that node. This may be a problem for libraries like JDO




回答3:


Note, I'm not using DataNucleus. However, when we separated our Master from our client we had to adjust the configuration.

Configuration conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", SERVER);
conf.set("hbase.zookeeper.property.clientPort", PORT);

You can look at your HBase web shell (usually: localhost:60010 on the master box) and get the ZK dump. Check if you're even making a connection to ZK.



来源:https://stackoverflow.com/questions/7176254/not-able-to-connect-to-remote-hbase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!