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 ...
随机推荐
- 学习Android之SimpleAdapter显示网络图片
效果图: 此程序基本的知识点是:SimpleAdapter本身是不支持网络图片的, 假设在Map.put(a,b)中 b为一个Bitmap,程序不会报红色字体,而是在控制台输出绿色的字体,例如以下 0 ...
- javascript花式理解闭包
一.变量的作用域 要理解闭包,首先必须理解Javascript特殊的变量作用域. 变量的作用域无非就是两种:全局变量和局部变量. Javascript语言的特殊之处,就在于函数内部可以直接读取全局变量 ...
- 【转】iOS - SQLite 数据库存储
本文目录 1.SQLite 数据库 2.iOS 自带 SQLite 的使用 3.fmdb 的使用 4.fmdb 多线程操作 5.其他 SQLite 的第三方封装库 回到顶部 1.SQLite 数据库 ...
- 【Agile123】Automated Test in Agile
https://www.infoq.com/articles/thoughts-on-test-automation-in-agile Start Small Balance the cost vs. ...
- git +maven+java+jenkins自动化代码持续集成
1.安装JDK JDK下载: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 新 ...
- YUV420图像旋转90算法的优化
在做android摄像头捕获时,发现从android摄像头出来的原始视是逆时针旋转了90度的,所以须要把它顺时针旋转90.android视频支持的是NV21格式,它是一种YUV420的格式.当然,始果 ...
- 在jupyter中安装R的kernal
网上有安装完anaconda后可以直接使用conda 命令安装R的kernal,本人电脑上已经安装了anaconda和R,因此使用手动安装的方式安装. 安装环境: windows 8.1 企业版 An ...
- Verdi调用VCS进行交互式仿真
前一篇介绍了使用Verdi的后处理模式查看仿真波形进行调试,此外Verdi还支持交互模式,可以调用外部仿真器,下面介绍Verdi调用VCS进行交互模式仿真的方法.注意,这里介绍的方法需要2016版的V ...
- 【转】如何内网搭建NuGet服务器
原文:http://www.cnblogs.com/zhangweizhong/p/7755332.html NuGet 是.NET程序员熟知的工具,它可以直接安装开源社区中的各个公用组件,可以说是非 ...
- jslint
auto execution/self execution/ Immediate function http://www.jslint.com/ (function () { 'use strict' ...