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 ...
随机推荐
- 使用jquery+css实现瀑布流布局
虽然可以直接使用css实现瀑布流布局,但显示的方式有点问题,所以这儿就直接使用jquery+css来实现瀑布流布局,最终效果如下: 思路是通过将每个小块的position设置为relativ ...
- 如何使用jQuery从字符串中删除最后一个字符
如何使用jQuery从字符串中删除最后一个字符 1.string.slice(0,-1) 2.str.substring(0,str.length-1)
- kubernetes学习笔记之七: Ingress-nginx 部署使用
一.Ingress 简介 在Kubernetes中,服务和Pod的IP地址仅可以在集群网络内部使用,对于集群外的应用是不可见的.为了使外部的应用能够访问集群内的服务,在Kubernetes 目前 提供 ...
- 10-安装es
1.安装jdk(jdk要求1.8.20或1.7.55以上) 2.上传es安装包 3.解压es tar -zxvf elasticsearch-2.3.1.tar.gz -C /opt/app/ 4.e ...
- python-单元测试优化,加入日志
HttpRequests.py #-*- coding:utf-8 -*- import requests class HttpRequests(): def http_requests(self,u ...
- java面试题收集
http://www.cnblogs.com/yhason/archive/2012/06/07/2540743.html 2,java常见面试题 http://www.cnblogs.com/yha ...
- 解决idea下载依赖包慢到出奇
右键项目选中maven选项,然后选择“open settings.xml”或者 “create settings.xml”,然后把如下代码粘贴进去就可以了.重启IDE. <?xml versio ...
- java Integer类以及拆箱和装箱
package com.ilaw.boson.controller; public class Demo { public static void main(String[] args) { Inte ...
- python 的深浅copy
1.引用: A=B, 修改B后,A会被修改 2.浅拷贝:A=copy.copy(B) 3.深拷贝:A=copy.deepcopy(B) 如果希望任何改变,两个对象都不会相互影响,用深拷贝.详情参考:h ...
- subString(index,end) 用法
sb = sb.Substring(0, sb.Length - 1); 获取当前字符串的前一部分去掉最后一个字符