关于报错
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)的更多相关文章

  1. pyhive -- thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

    Pyhive 远程连接hive出现问题: from pyhive import hive import pandas as pd #Create Hive connection conn = hive ...

  2. hue集成hbase出现TSocket read 0 bytes

    解决办法:修改hbase的配置文件 添加以下配置 https://stackoverflow.com/questions/20415493/api-error-tsocket-read-0-bytes ...

  3. HttpClient Received an unexpected EOF or 0 bytes from the transport stream

    请求https链接时报错,奇怪的是pc1正常,pc2异常 Unhandled Exception: System.AggregateException: One or more errors occu ...

  4. [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. ...

  5. 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 ...

  6. 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 ...

  7. [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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. Extjs TreePanel API详解

    转自:http://web.qhwins.com/CSS-JS-XML/2011091312092944999107.html config定义{ animate : Boolean, contain ...

  2. C++中重载决议与可访问性检查的顺序

    http://blog.csdn.net/starlee/article/details/1406781 对于如下的类: class ClxECS{public:    double Test(dou ...

  3. 线性dp

    线性dp应该是dp中比较简单的一类,不过也有难的.(矩乘优化递推请出门右转) 线性dp一般是用前面的状态去推后面的,也有用后面往前面推的,这时候把循环顺序倒一倒就行了.如果有的题又要从前往后推又要从后 ...

  4. virtualbox+vagrant学习-2(command cli)-7-vagrant login命令

    Login ⚠️该命令已经弃用了,别名为vagrant cloud auth login.看本博客的 格式: vagrant cloud auth login [options] 登录命令用于使用Ha ...

  5. php官网下载的chm手册,源码字号太小的问题解决

    首先,到官方网站上下载chm格式的文档,地址如下: http://php.net/downloads.php 如图,点击荧光笔标出链接 然后就可以看到各种语言版本的文档手册,可以选择中文版,并带有笔记 ...

  6. python 内置常用函数

    import os def set(o): return set(o) # =={o} def reverseObject(it): it.reverse() return it def sortOb ...

  7. FFMpeg笔记(五) 录制小视频时几个问题解决

    1. YUV数据在使用avfilter scale时在特定的分辨率下UV分量不对 由于是小视频,那么分辨率不需要太高,但是有的视频源是1080p,甚至有的是4K的,所以对视频源进行scale非常有必要 ...

  8. Linux磁盘与文件系统管理(一)

    fdisk 常用的磁盘分区工具,受mbr分区表的限制,只能给小于2TB的磁盘划分分区,如果使用fdisk对大于2TB的磁盘进行分区,虽然可以分区,但只能识别2T的空间,一般使用parted分区工具 - ...

  9. C++引用的用处

    原文:http://www.cnblogs.com/ddx-deng/archive/2012/12/16/3755864.html 一.什么是“引用”?声明和使用“引用”要注意哪些问题? 答:引用就 ...

  10. Facebook如何管理150亿张照片

    Facebook 的照片分享很受欢迎,迄今,Facebook 用户已经上传了150亿张照片,加上缩略图,总容量超过1.5PB,而每周新增的照片为2亿2000万张,约25TB,高峰期,Facebook ...