python通过thrift连接Hbase
来源:互联网 发布:js攻击脚本代码 编辑:程序博客网 时间:2024/06/10 15:02
第一步:安装python
通过本机下载Python源码 下载地址
https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
将源码上传至19服务器,路径为:/usr/local/share/
运行解压缩:tar -xzf Python-2.7.5.tgz
进入解压文件夹:cd Python-2.7.5 依次运行 以下命令
./configure make make install
在打印日志中可以看到,Python的安装路径为:/usr/local/lib/python2.7
第二步:安装thrift
通过本机下载thrift源码 下载地址
https://mirrors.tuna.tsinghua.edu.cn/apache/thrift/0.9.3/thrift-0.9.3.tar.gz
将源码上传至19服务器,路径为:/usr/local/share/
运行解压缩:tar -xzf thrift-0.9.3.tar.gz
进入解压文件夹:cd thrift-0.9.3 依次运行 以下命令
./configure make make install
第三步:python添加thrift模块
cd /usr/local/share/thrift-0.9.3/lib/pypython setup.py install
运行成功后,可在python运行环境/usr/local/lib/python2.7/site-packages中找到thrift模块
第三步:生成接口文件
通过本机下载hbase源码 下载地址
https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/0.98.20/hbase-0.98.20-src.tar.gz
将源码上传至19服务器,路径为:/usr/local/share/
运行解压缩:tar -xzf hbase-0.98.20-src.tar.gz
cd /usr/local/share/hbase-0.98.20/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift
thrift –gen py Hbase.thrift
第四步:python添加hbase模块
cp -r gen-py/hbase/ /usr/local/share/Python-2.7.5/Lib/site-packages
运行成功后,可在python运行环境/usr/local/lib/python2.7/site-packages中找到hbase模块
第四步:启动thrift服务
登录202服务器,启动hbase的thrift服务
hbase thrift -p 9090 start
运行成功
第五步:运行test
test.py
import syssys.path.append('/usr/local/lib/python2.7/site-packages/hbase')from thrift import Thriftfrom thrift.transport import TSocketfrom thrift.transport import TTransportfrom thrift.protocol import TBinaryProtocolfrom hbase import Hbasefrom hbase.ttypes import *transport = TSocket.TSocket('10.18.210.202', 9090)transport = TTransport.TBufferedTransport(transport)protocol = TBinaryProtocol.TBinaryProtocol(transport)client = Hbase.Client(protocol)transport.open()print(client.getTableNames())
运行成功后,可打印hbase中的表名
相关引用:
http://blog.sina.com.cn/s/blog_9f48885501018g03.html
http://shineforever.blog.51cto.com/1429204/1567640
- python通过thrift连接Hbase
- [原创]Python通过Thrift连接HBase
- Python 通过thrift接口连接Hbase读取存储数据
- Python通过thrift连接Hbase(详细配置步骤)
- python通过thrift操作hbase
- pyspark Python 连接 HBase thrift
- Thrift安装配置及使用python通过thrift连接HBase测试
- C#通过thrift连接hbase操作步骤
- python 通过thrift 简单操作hbase
- 通过Python使用HBase Thrift接口 url
- python 通过thrift 简单操作hbase
- php/perl/python , 通过thrift 连接 hbase,进行条件过滤选择
- Python 使用thrift连接hbase || 远程连接hbase
- python通过thrift方式连接hive
- php 通过 thrift-0.8.0 连接hbase 以及函数使用
- 使用Python通过Thrift接口访问HBase和Hive
- 使用Python语言通过Thrift 网关操作HBase
- 嵌套类型Array[struct]通过python+thrift保存至HBase
- 验证码无法显示,服务器端出现异常:Could not initialize class sun.awt.X11GraphicsEnvironment
- iOS多显示器编程指导
- HTML <meta> 标签 遇到<meta http-equiv="refresh" content="0; url=">详解
- windows10 安装zookeeper
- 系统app使用动态库加载失败
- python通过thrift连接Hbase
- Android Data Binding
- Android Studio调试功能使用总结【转】
- 祖先们都在看着你
- 什么是数据结构&算法,主要包括那几种
- CF 678F Lena and Queries
- 人脸识别技术资料和源码(包含人脸库)
- C#中设置Excel单元格格式
- JAVA工程师个人职业规划