美文网首页
Python 访问 Hbase

Python 访问 Hbase

作者: 马赛克同学 | 来源:发表于2019-08-19 07:59 被阅读0次

一、前提要求

1、thrift

2、hbase-thrift 

:我通过pycharm安装

二、启动Hbase

cd /usr/local/hbase

./sbin/start-hbase.sh

三、连接访问

from thrift.transportimport TSocket, TTransport

from thrift.protocolimport TBinaryProtocol

from hbaseimport Hbase

# thrift 默认端口为9090

host ='localhost'

port ='9090'

socket = TSocket.TSocket(host, port)

socket.setTimeout(5000)

transport = TTransport.TBufferedTransport(socket)

protocol = TBinaryProtocol.TBinaryProtocol(transport)

client = Hbase.Client(protocol)

socket.open()

相关文章

网友评论

      本文标题:Python 访问 Hbase

      本文链接:https://www.haomeiwen.com/subject/wdwdjctx.html