using python read/write HBase data
A. operations on Server side
1. ensure hadoop and hbase are working properly
2. install thrift: apt-get install thrift
3. download hbase source code package: HERE(hbase 0.98 src) . Then extract package to /home/hadoop/hbase-0.98.12.1
4. cd /home/hadoop/hbase-0.98.12.1
thrift --gen py /hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
5. cd /hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/
cp -r gen-py/ /usr/lib/python2.7/
6. RUN HBase Thrift: hbase thrift -p 9090 start
B. operation on Client side
1. pip install thrift
pip install hbase-thrift
C. TEST
1. on Server side, enter hbase shell
create'member','member_id','address','info'
create 'member1','member_id','address','info'
create 'member2','member_id','address','info'
2. on Client side,
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from hbase import Hbase
from hbase.ttypes import * transport =TSocket.TSocket('192.168.2.107', 9090)
transport =TTransport.TBufferedTransport(transport)
protocol =TBinaryProtocol.TBinaryProtocol(transport)
client = Hbase.Client(protocol)
transport.open()
print(client.getTableNames())
3. run

REF:
http://www.cnblogs.com/hitandrew/archive/2013/01/21/2870419.html
http://edu.dataguru.cn/thread-354800-1-1.html
http://blog.csdn.net/a1368783069/article/details/51019835
using python read/write HBase data的更多相关文章
- Python Web-第二周-正则表达式(Using Python to Access Web Data)
0.课程地址与说明 1.课程地址:https://www.coursera.org/learn/python-network-data/home/welcome 2.课程全名:Using Python ...
- Restore HBase Data
方法 1: Restoring HBase data by importing dump files from HDFS The HBase Import utility is used to loa ...
- Backing Up and Restoring HBase Data
There are two strategies for backing up HBase:1> Backing it up with a full cluster shutdown2> ...
- /usr/bin/python: can't decompress data; zlib not available 的异常处理
1. 问题背景 使用Pycharm连接远程服务器端pipenv虚拟环境的python解释器,运行python spark脚本时报错如下错误: 2018-09-12 23:56:00 ERROR Exe ...
- 【Python学习笔记】Coursera课程《Using Python to Access Web Data》 密歇根大学 Charles Severance——Week6 JSON and the REST Architecture课堂笔记
Coursera课程<Using Python to Access Web Data> 密歇根大学 Week6 JSON and the REST Architecture 13.5 Ja ...
- 【Python学习笔记】Coursera课程《Using Python to Access Web Data 》 密歇根大学 Charles Severance——Week2 Regular Expressions课堂笔记
Coursera课程<Using Python to Access Web Data > 密歇根大学 Charles Severance Week2 Regular Expressions ...
- 《Using Python to Access Web Data》 Week5 Web Services and XML 课堂笔记
Coursera课程<Using Python to Access Web Data> 密歇根大学 Week5 Web Services and XML 13.1 Data on the ...
- 《Using Python to Access Web Data》Week4 Programs that Surf the Web 课堂笔记
Coursera课程<Using Python to Access Web Data> 密歇根大学 Week4 Programs that Surf the Web 12.3 Unicod ...
- 《Using Python to Access Web Data》 Week3 Networks and Sockets 课堂笔记
Coursera课程<Using Python to Access Web Data> 密歇根大学 Week3 Networks and Sockets 12.1 Networked Te ...
随机推荐
- 说下spring生命周期
面试官:说下spring生命周期 程序员:不会 那你先回去等消息吧 Bean实现了BeanNameAware,Spring会将Bean的ID透传给setBeanName java.后端开发.程 ...
- openstack网络
OpenStack中neutron的2种ip.3种管理模式 Nova有固定IP和浮动IP的概念.固定IP被分发到创建的实例不再改变,浮动IP是一些可以和实例动态绑定和释放的IP地址. Nova支持3种 ...
- 【学习】数据处理基础知识(汇总和计算描述统计)【pandas】
pd对象拥有一组常用的数学和统计方法.大部分都属于约简和汇总统计,用于从Series中单个值,如sum 和 mean 或从DF的行或列中提取一个Series. 1. 描述和汇总统计方法 #汇总和计算描 ...
- Jmeter正则表达式提取器(转载)
转载自 http://blog.csdn.net/qq_35885203 使用jmeter来测试时,经常会碰到需要上下文传输数据的情况,如登录后生成的token,在其他页面的操作,都需传入这个toke ...
- [Shell]Bash变量:数值运算及运算符
------------------------------------------------------------------------------------------------- Sh ...
- MySQL中IN子查询会导致无法使用索引
今天看到一个博客园的一篇关于MySQL的IN子查询优化的案例,一开始感觉有点半信半疑(如果是换做在SQL Server中,这种情况是绝对不可能的,后面会做一个简单的测试.)随后动手按照他说的做了一个表 ...
- <Dare To Dream 团队>第一次作业:团队亮相
队名:Dare To Dream 2.团队成员组成:学号/姓名(标记团队组长): 201571030333/绽玉林(组长) 201571030132/姚慧霞 201571030308/李金平 2 ...
- 牛客网-乌龟跑步-(四维dfs)
链接:https://ac.nowcoder.com/acm/problem/15294来源:牛客网 题目描述 有一只乌龟,初始在0的位置向右跑. 这只乌龟会依次接到一串指令,指令T表示向后转,指令F ...
- 微信小程序---setData
data:{ obj:{ name:'hello' } } 对data中obj的name字段进行重新赋值. onLoad: function (option) { var value = 'obj.n ...
- 云笔记项目-Java反射知识学习
在云笔记项目中,补充了部分反射的知识,反射这一部分基础知识非常重要,前面学习的框架Spring和MyBatis读取xml配置文件创建对象,以及JDBC加载驱动等都用了反射,但只知道有这个东西,具体不知 ...