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 ...
随机推荐
- C# 调用Tesseract实现OCR
介绍 Tesseract是一个基于Apache2.0协议开源的跨平台ocr引擎,支持多种语言的识别,在Windows和Linux上都有良好的支持. 创建工程 创建一个C#的控制台工程 添加System ...
- composer在phpstorm中安装代码库
E:\php\PHPTutorial\WWW\kmmhtt>composer install composer 安装地址 :https://getcomposer.org/download/
- 深入理解volatile
volatile知识点 --------------------------------------------------------------------------- 1.volatile关键 ...
- FTP管理常用命令
#新增用户liuhui,指定群组为groupa,附加群组为groupb,家目录为/ftp/groupbuseradd -g groupa -G groupb -d /ftp/groupb linhui ...
- 非常优秀的swiper插件————幻灯片播放、图片轮播
http://www.idangero.us/ http://www.swiper.com.cn/ Swiper中文网 2015-10-15 SuperSlide2: (这是个PC用的滚屏插件,看着不 ...
- javaee_正则表达式基础和常用表达式
正则基础: 1.1 -字符集 [ ] : 代表单个字符. [^] : 除了该字符外的所有单个字符. [a-zA-Z] : [a-z] || [A-Z]. [a-d[m-p]] :[a, d] || [ ...
- virtual 函数只有在用指针或引用的方式访问,才会导致多态。
只有用指针和引用,才会动态绑定.才会在运行时候从虚表中找对应的成员函数. 如果只是用.访问成员函数,是静态绑定,在编译时刻就固定好的. 另外,父类的虚函数,子类不管加不加virtual关键字,都是虚函 ...
- 关于php利用数组中某个字段进行排序
工作中用到了一个相关的问题,搜索了百度有好多种方法,但是不同方法对应的函数不同,试了几个发现还是下面这个比较好用: array_multisort($sortarray,SortRank,$sortl ...
- 【Noip模拟 20160929】划区灌溉
题目描述 约翰的奶牛们发现山脊上的草特别美味.为了维持草的生长,约翰打算安装若干喷灌器. 为简化问题,山脊可以看成一维的数轴,长为L(1≤L≤1,000,000)L(1≤L≤1,000,000),而且 ...
- 尚硅谷springboot学习31-jdbc数据连接
可以使用JdbcTemplate操作数据库,可以在启动的时候自动建表,更新数据表 配置依赖 <dependency> <groupId>org.springframework. ...