【问题标题】:Hbase remotely connecting to standalone instanceHbase 远程连接独立实例
【发布时间】:2017-06-06 14:52:16
【问题描述】:

我第一次尝试设置 HBase。我能够在服务器上成功运行本机 Hbase shell。但我无法通过客户端远程连接。

我在主机上使用以下命令启动 Hbase: /home/kirill/hbase/hbase-1.2.5/bin/start-hbase.sh

要从客户端连接,我在 Python (Anaconda) 中运行以下命令:

>>> import happybase
>>> co = happybase.Connection('192.168.0.18',2181)
>>> co.tables()

尝试使用co.tables() 列出表后出现以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\soft\miniconda2\lib\site-packages\happybase\connection.py", line 242, in tables
    names = self.client.getTableNames()
  File "C:\soft\miniconda2\lib\site-packages\thriftpy\thrift.py", line 198, in _req
    return self._recv(_api)
  File "C:\soft\miniconda2\lib\site-packages\thriftpy\thrift.py", line 210, in _recv
    fname, mtype, rseqid = self._iprot.read_message_begin()
  File "C:\soft\miniconda2\lib\site-packages\thriftpy\protocol\binary.py", line 372, in read_message_begin
    self.trans, strict=self.strict_read)
  File "C:\soft\miniconda2\lib\site-packages\thriftpy\protocol\binary.py", line 164, in read_message_begin
    sz = unpack_i32(inbuf.read(4))
  File "C:\soft\miniconda2\lib\site-packages\thriftpy\transport\__init__.py", line 32, in read
    return readall(self._read, sz)
  File "C:\soft\miniconda2\lib\site-packages\thriftpy\transport\__init__.py", line 14, in readall
    chunk = read_fn(sz - have)
  File "C:\soft\miniconda2\lib\site-packages\thriftpy\transport\buffered\__init__.py", line 39, in _read
    self._rbuf = BytesIO(self._trans.read(max(sz, self._buf_size)))
  File "C:\soft\miniconda2\lib\site-packages\thriftpy\transport\socket.py", line 125, in read
    message='TSocket read 0 bytes')
thriftpy.transport.TTransportException: TTransportException(message='TSocket read 0 bytes', type=4)

以下是 Hbase 日志的最后 3 行:

它表示来自 192.168.0.11(客户端 IP)的连接被接受,但随后它立即抛出 Exception causing close of session:

2017-06-06 10:48:10,634 INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxnFactory: Accepted socket connection from /192.168.0.11:58052
2017-06-06 10:48:11,841 WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxn: Exception causing close of session 0x0 due to java.io.IOException: Len error -2147418111
2017-06-06 10:48:11,842 INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxn: Closed socket connection for client /192.168.0.11:58052 (no session established for client)

任何帮助将不胜感激。这是主机设置:

Hbase 设置:

运行 Hbase 的主机:Ubuntu Server、Ubuntu 16.04.1 LTS(GNU/Linux 4.4.0-31-generic x86_64)

Hbase bin 文件夹路径:/home/kirill/hbase/hbase-1.2.5/bin

主机IP:192.168.0.18

conf/hbase-site.xml:

<configuration>

    <property>
        <name>hbase.rootdir</name>
        <value>file:///home/kirill/hbase/hbase-1.2.5/</value>
    </property>

    <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>/home/kirill/zookeeper</value>
    </property>

    <property>
        <name>hbase.zookeeper.property.clientPort</name>
        <value>2181</value>
    </property>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>192.168.0.18</value>
    </property>

</configuration>

/etc/hosts:

127.0.0.1   localhost
192.168.0.18    ubuntu

【问题讨论】:

    标签: hbase


    【解决方案1】:

    发现此问题针对happybase python 包打开:https://github.com/wbolster/happybase/issues/6

    现在可以了。 需要以不同方式完成 2 件事:

    1. hbase 必须使用 Thrift 启动,如下所示: /home/kirill/hbase/hbase-1.2.5/bin/hbase thrift start -threadpool

    2. 我不应该连接到hbase.zookeeper.property.clientPort下指定的端口,即2181,而是happybase Connection()函数中使用的默认端口,我认为是9090。

      李>

    我也将我的 /etc/hosts 文件更改为:

    192.168.0.18 ubuntu.ubuntu-domain ubuntu localhost

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多