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的更多相关文章

  1. Python Web-第二周-正则表达式(Using Python to Access Web Data)

    0.课程地址与说明 1.课程地址:https://www.coursera.org/learn/python-network-data/home/welcome 2.课程全名:Using Python ...

  2. Restore HBase Data

    方法 1: Restoring HBase data by importing dump files from HDFS The HBase Import utility is used to loa ...

  3. Backing Up and Restoring HBase Data

    There are two strategies for backing up HBase:1> Backing it up with a full cluster shutdown2> ...

  4. /usr/bin/python: can't decompress data; zlib not available 的异常处理

    1. 问题背景 使用Pycharm连接远程服务器端pipenv虚拟环境的python解释器,运行python spark脚本时报错如下错误: 2018-09-12 23:56:00 ERROR Exe ...

  5. 【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 ...

  6. 【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 ...

  7. 《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 ...

  8. 《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 ...

  9. 《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 ...

随机推荐

  1. [SQL]某数据库中查出包含 字段名 的所有表名

    --利用SQL语句来查询字段所在的表 --从某数据库中查出包含 字段名 字段的所有表名 SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE ...

  2. Docker系列08:容器监控

    1 监控解决方案 cadvisor+influxdb+grafana cAdvisor:Google开源的工具,用于监控Docker主机和容器系统资源,通过图形页面实时显示数据,但不存储:它通过宿主机 ...

  3. Java虚拟机------JVM介绍

    Java平台和语言最开始只是SUN公司在1990年12月开始研究的一个内部项目: Java的平台无关性 Java平台和语言最开始只是SUN公司在1990年12月开始研究的一个内部项目[stealth ...

  4. postgresql数据库备份

    一.工具备份数据 打开windows下的命令窗口:开始->cmd->安装数据库的目录->进入bin目录: 导出命令:pg_dump –h localhost –U postgres ...

  5. Laravel线上布暑到linux的问题汇总

    1.直接报403错误 ,配置文件中增加: location / { try_files $uri $uri/ /index.php?$query_string; } 同时根目录不是指到项目名,而是指到 ...

  6. postgresql数据库varchar、char、text的比较

    名字 描述character varying(n), varchar(n) 变长,有长度限制character(n), char(n) 定长,不足补空白text 变长,无长度限制简单来说,varcha ...

  7. 浅谈MyBatisGenerator的使用

    目录 1.概述 2.依赖 3.Maven插件配置 4.配置文件说明 5.运行 6.总结 1.概述 日常中使用MyBatis最为麻烦的就是编写Mapper文件了, 如果数据库增加一张表, 这时通常会复制 ...

  8. go相关知识点

    后续开发go相关, 环境搭建 go env //查看环境所有 go只有三种引用类型 slice(切片). map(字典). channel(管道): go的类型的浅记忆 4仲类型bool,字符串,数字 ...

  9. DJango 基础 (2)

    urls.py路由用法 知识点 url基本概念 url格式 urls.py的作用 url解析过程 include的作用 kwarg的作用 name的作用 URL概念 URL(Uniform Resou ...

  10. 工具类静态方法注入dao

    工具类里的一个静态方法需要调用dao查询数据库,用普通的spring注解注入一直报空指针异常,不能找到这个dao.参考的http://busing.iteye.com/blog/899322 的文章解 ...