gpt4 book ai didi

python - Hbase超时错误不断出现

转载 作者:可可西里 更新时间:2023-11-01 16:44:59 26 4
gpt4 key购买 nike

我正在使用带有 python 的 happybase 访问 Hbase。

我有一个非常简单的函数:

def connect():

connection = happybase.Connection('myhost',myport)
table = connection.table('MY-TABLE')
try:
return str(table.row('my-row'))
except Exception as ioe:
return str(ioe)
finally:
connection.close()

当我运行这个函数时,它可以正常工作几分钟,然后我开始收到超时错误。

解决方法是进入 Hbase 控制台并打开一个新的 thrift 端口,然后指向它。

这再次工作了几分钟,然后我再次收到超时错误。

不是很好的解决方法,知道为什么会发生这种情况吗?

编辑

这里是错误:

`Traceback (most recent call last):
File "appi.py", line 38, in <module>
print connectx()
File "appi.py", line 26, in connectx
print str(table.row('1464242429566-2531079631688429'))
File "C:\Users\me\Downloads\happybase-master\happybase-master\happybase\table.py", line 116, in row
self.name, row, columns, {})
File "C:\Python27\lib\site-packages\thriftpy-0.3.8-py2.7.egg\thriftpy\thrift.py", line 160, in _req
return self._recv(_api)
File "C:\Python27\lib\site-packages\thriftpy-0.3.8-py2.7.egg\thriftpy\thrift.py", line 172, in _recv
fname, mtype, rseqid = self._iprot.read_message_begin()
File "C:\Python27\lib\site-packages\thriftpy-0.3.8-py2.7.egg\thriftpy\protocol\binary.py", line 372, in read_message_begin
self.trans, strict=self.strict_read)
File "C:\Python27\lib\site-packages\thriftpy-0.3.8-py2.7.egg\thriftpy\protocol\binary.py", line 164, in read_message_begin
sz = unpack_i32(inbuf.read(4))
File "C:\Python27\lib\site-packages\thriftpy-0.3.8-py2.7.egg\thriftpy\transport\__init__.py", line 32, in read
return readall(self._read, sz)
File "C:\Python27\lib\site-packages\thriftpy-0.3.8-py2.7.egg\thriftpy\transport\__init__.py", line 14, in readall
chunk = read_fn(sz - have)
File "C:\Python27\lib\site-packages\thriftpy-0.3.8-py2.7.egg\thriftpy\transport\buffered\__init__.py", line 39, in _read
self._rbuf = BytesIO(self._trans.read(max(sz, self._buf_size)))
File "C:\Python27\lib\site-packages\thriftpy-0.3.8-py2.7.egg\thriftpy\transport\socket.py", line 108, in read
buff = self.sock.recv(sz)
socket.timeout: timed out`

最佳答案

通过在 hbase-site.xml 中设置属性来增加超时,该属性将在 hbase/conf 中可用

<property>
<name>hbase.regionserver.lease.period</name>
<value>900000</value> <!-- 900 000, 15 minutes -->
</property>
<property>
<name>hbase.rpc.timeout</name>
<value>900000</value> <!-- 15 minutes -->
</property>
<property>
<name>zookeeper.session.timeout</name>
<value>20000</value>
</property>

关于python - Hbase超时错误不断出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37570762/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com