如何为hbase指定RPC服务器端口? [英] How to specify RPC server port for hbase?

查看:409
本文介绍了如何为hbase指定RPC服务器端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在docker容器中启动hbase,并希望客户端代码能够连接到hbase rpc服务器端口.问题是:它总是不同的(从临时端口范围中随机选择).

I'm starting hbase inside a docker container and want client code to be able to connect to hbase rpc server port. Problem is: it is always different (randomly selected from ephemeral ports range).

浏览hbase代码( hbase.regionserver.port "或" hbase.master.port "来覆盖端口.

Looking through hbase code (https://github.com/apache/hbase/blob/9facfa550f1e7386be3a04d84f7e8013f5002965/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java, bindAddress from line 1078) I see that I can override port by setting "hbase.regionserver.port" or "hbase.master.port".

我尝试在hbase-conf.xml中设置它们,但没有任何效果-端口仍然是随机的,好像这些属性已解析为0.

I tried setting these in hbase-conf.xml but without any effect - port is still random as if these properties were resolved to 0.

我该如何更改?

推荐答案

找到了解决方案.默认情况下,Hbase以独立模式启动,并且端口是随机选择的.因此,在阅读 doc 之后,我编辑了hbase-site.xml看起来像这样:

Found the solution. By default Hbase starts in a standalone mode and port is selected randomly. So after reading the doc I edited the hbase-site.xml to look like this:

<configuration>
<property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
</property>
<property>
    <name>hbase.regionserver.ipc.address</name>
    <value>0.0.0.0</value>
</property>
<property>
    <name>hbase.master.ipc.address</name>
    <value>0.0.0.0</value>
</property>

请注意,我正在使其以分布式模式(在我的情况下为伪分布式)运行,并将master和regionserver的ipc侦听地址设置为0.0.0.0(否则,您仍然可以t从docker容器外部连接).这些更改之后,端口变得稳定,因此一切都很好.

Notice that I'm making it run in a distributed mode (pseudo-distributed in my case) and set ipc listen addresses to 0.0.0.0 for both master and regionserver (otherwise you still can't connect from outside of docker container). After these changes ports became stable so everything is fine.

附加说明:切换到分布式模式后,我必须在hbase-env.sh中专门设置JAVA_HOME.不过,这可以在文档中找到.

Additional note: after switching to a distributed mode I had to set JAVA_HOME specifically in hbase-env.sh. This can be found in docs though.

这篇关于如何为hbase指定RPC服务器端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆