【HappyBase】连接hbase报错:ecybin.ProtocolError: No protocol version header
问题
使用以下代码访问 hbase 时出现错误: ecybin.ProtocolError: No protocol version header
def test_hbase():
import happybase
# 通过size控制连接池中的连接数量
# pool = happybase.ConnectionPool(size=3, host="192.168.1.2", port=9090, protocol='compact', transport='framed')
pool = happybase.ConnectionPool(size=3, host="192.168.1.2", port=9090)
# 从连接池中取出一个连接
with pool.connection() as conn:
print(conn.tables())
print("success")
if __name__ == '__main__':
test_hbase()
解决
在 hbase-site.xml 中更改了一些设置后,它现在可以工作了!!我删除了以下属性:
<property>
<name>hbase.regionserver.thrift.http</name>
<value>true</value>
</property>
<property>
<name>hbase.thrift.support.proxyuser</name>
<value>true/value>
</property>
这两个选项,但是经过实际测试,开启这两个选项不仅会让 hue 无法连接上去,就连 happybase 也会报错。所以关闭了