happybase(TSocket read 0 bytes)
关于报错
happybase 是使用python连接hbase的一个第三方库,目前基于thrift1 。在使用过程中经常碰到报错
TTransportException(type=4, message='TSocket read 0 bytes')
即使使用thrift server首页上提供了连接Apache HBase Wiki on Thrift里的demo也一样报错。
测试代码
import happybase
def get_tables_name(host,port):
conn = happybase.Connection(host=host,port=port)
return conn.tables()
很简单,就是连接hbase,返回所有table名称。
报错可能原因
hbase 未开启thrift服务
Connection参数与thrift服务不匹配
Connection参数
看一下官网wiki上建立连接的例子
from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TBufferedTransport
from thrift.protocol import TBinaryProtocol
from hbase import Hbase
transport = TBufferedTransport(TSocket(host, port))
transport.open()
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = Hbase.Client(protocol)
构建一个连接需要两个辅助类 TBufferedTransport,TBinaryProtocol。其中transport负责通讯协议,protocol负责序列化协议。
happybase connection
happybase官网上对于connection的介绍connection的介绍
总结有三个参数需要匹配
protocol: binary (the default) and compact
compat :0.90, 0.92, 0.94, or 0.96 (the default)
transport :buffered (the default) and framed
在我将上述测试代码改为
import happybase
def get_tables_name(host,port):
conn = happybase.Connection(host=host,port=port,protocol='compact',transport='framed')
return conn.tables()
就没问题了。
转自:https://blog.csdn.net/zhnxin_163/article/details/82879417
happybase(TSocket read 0 bytes)的更多相关文章
- pyhive -- thrift.transport.TTransport.TTransportException: TSocket read 0 bytes
Pyhive 远程连接hive出现问题: from pyhive import hive import pandas as pd #Create Hive connection conn = hive ...
- hue集成hbase出现TSocket read 0 bytes
解决办法:修改hbase的配置文件 添加以下配置 https://stackoverflow.com/questions/20415493/api-error-tsocket-read-0-bytes ...
- HttpClient Received an unexpected EOF or 0 bytes from the transport stream
请求https链接时报错,奇怪的是pc1正常,pc2异常 Unhandled Exception: System.AggregateException: One or more errors occu ...
- [Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
待解决 [Fiddler] ReadResponse() failed: The server did not return a complete response for this request. ...
- Mysql: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
2019-05-28 01:53:42.762 [message remind thread-24] ERROR druid.sql.Statement - {conn-10327, stmt-320 ...
- CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
今天,在用icinga服务器端测试客户端脚本时,报如下错误: [root@mysql-server1 etc]# /usr/local/icinga/libexec/check_nrpe -H 192 ...
- [Linux] Boot分区满了的处理方法 The volume "boot" has only 0 bytes disk space remaining
1.查看系统目前正在用的内核 abby@abby:~$ uname -r ..--generic 2.查看/boot保存的所有内核 abby@abby:~$ ls -lah /boot total 3 ...
- Installation failed: Timeout was reached: Operation timed out after 10000 milliseconds with 0 out of 0 bytes received
Trying this option worked for me. library(httr) with_config(use_proxy(...), install_github(...)) OR ...
- jeecms运行出现 Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.解决
在/WEB-INF/config/application-context.xml中添加红色字体内容: <bean id="dataSource" class="co ...
随机推荐
- 1001. [BJOI2006]狼抓兔子【最小割】
Description 现在小朋友们最喜欢的"喜羊羊与灰太狼",话说灰太狼抓羊不到,但抓兔子还是比较在行的, 而且现在的兔子还比较笨,它们只有两个窝,现在你做为狼王,面对下面这样一 ...
- 使用阿里云的maven仓库
在maven的settings.xml文件里的mirrors节点,添加如下子节点: <mirror> <id>nexus-aliyun</id> <mirro ...
- Java 中 Emoji 的正则表达式
一.emoji 的范围 查阅维基百科中 emoji 的说明 1. 杂项符号及图形 杂项符号及图形一共有768个字符,范围为: U+1F300 - U+1F5FF,在 Java 中正则表达式为: &qu ...
- C++ pair(对组)的简单了解
类模板:template<class T1,class T2> struct pair 参数:T1是第一个值得数据类型,T2是第二个值的数据类型. 功能:pair将一对值组合成一个值, 这 ...
- c++—— 函数重载(Overroad)
5 函数重载(Overroad) 函数重载概念 1 函数重载概念 函数重载(Function Overload) 用同一个函数名定义不同的函数 当函数名和不同的参数搭配时函数的含义不同 2 函数重载的 ...
- openshift 持续集成与部署 -- 构建部署流水线
Jenkins持续构建说得更直白点,就是各种项目的"自动化"编译.打包.分发部署.j跟svn.git能无缝集成,也支持直接与知名源代码托管网站,比如github.bitbucket ...
- 404 Note Found队Beta4
目录 组员情况 组员1(组长):胡绪佩 组员2:胡青元 组员3:庄卉 组员4:家灿 组员:恺琳 组员6:翟丹丹 组员7:何家伟 组员8:政演 组员9:黄鸿杰 组员10:刘一好 组员11:何宇恒 展示组 ...
- iOS之让UISearchBar搜索图标和placeholder靠左显示
系统UISearchBar效果图: 需求效果图: 两种方案: 找到UISearchBar上的放大镜图标, 修改Frame. 同时判断在有无文本内容更改placeholder的颜色. 利用UISearc ...
- 20155301 滕树晨linux基础——linux进程间通信(IPC)机制总结
20155301 滕树晨linux基础--linux进程间通信(IPC)机制总结 共享内存 共享内存是在多个进程之间共享内存区域的一种进程间的通信方式,由IPC为进程创建的一个特殊地址范围,它将出现在 ...
- Linux下开发python django程序(设置admin后台管理模块)
1.新建项目和项目下APP django-admin startproject csvt03 django-admin startapp app1 2.修改settings.py文件 设置默认安装AP ...