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 ...
随机推荐
- virtualbox+vagrant学习-2(command cli)-2-vagrant cloud命令--有问题
Cloud https://www.vagrantup.com/docs/cli/cloud.html 命令: vagrant cloud 这是用来管理与vagrant相关的任何东西的命令. 该命令的 ...
- Docker实战(三)之访问Docker仓库
仓库是集中存放镜像的地方,分为公共仓库和私有仓库.一个容易与之混肴的概念是注册服务器.实际上注册服务器是存放仓库的具体服务器,一个注册服务器上可以有多个仓库,而每个仓库下面可以有多个镜像.从这方面来说 ...
- SQLserver中取众位数的写法
取众位数:先按个数倒排序,再取第一条SELECT * FROM ( select a.billid,a.DemandVoltage,count(1) as RecordCount, Row_NUMBE ...
- Spring源码分析(十二)FactoryBean的使用
摘要:本文结合<Spring源码深度解析>来分析Spring 5.0.6版本的源代码.若有描述错误之处,欢迎指正. 一般情况下,Spring通过反射机制利用bean的class属性指定实现 ...
- centos下Zabbix Agent端部署和安装
首先重复一下前面的规划 server端: 192.168.136.144 centos6.5 (虚拟机) agent端: 192.168.136.155 centos6.5( 虚拟 ...
- 谈谈我的js学习过程(二)——“Hello World!”
在<谈谈我的js学习过程(一)>中,我简单聊了一下我认为的javascript的学习方法,接下来我们可以尝试来写一个最简单的js代码. "Hello World!"对于 ...
- NLPIR(北理工张华平版中文分词系统)的SDK(C++)调用方法
一.本文内容简介 二.具体内容 1. 中文分词的基本概念 2.关于NLPIR(北理工张华平版中文分词系统)的基本情况 3.具体SDK模块(C++)的组装方式 ①准备内容: ②开始组装 三.注意事项 一 ...
- jQuery----淘宝商品展示(类似与tab切换)
实现效果如图: 功能需求: ①鼠标进入商品名称,商品名称变色,同时对应的物品展示图片显示对应的物品,鼠标移出时候,商品名称恢复原来的颜色 实现分析: 1.HTML+CS ...
- Linux服务-samba
目录 1. samba简介 2. samba访问 Linux服务-samba 1. samba简介 Samba是在Linux和UNIX系统上实现SMB协议的一个免费软件,由服务器及客户端程序构成. 在 ...
- GoLand(二)语言结构和基础语法
Infi-chu: http://www.cnblogs.com/Infi-chu/ 一.Go语言结构1.Go语言有6大部分组成,分别是:包声明.引入包.函数.变量.语句或表达式.注释2.输出一个He ...