python thrift hbase安装连接
默认已装好
- hbase,我的版本是hbase-0.98.24,并运行
- python 2.7.x
步骤:
sudo apt-get install automake bison flex g++ git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config,安装这些必要的包和库,官网的是libboost1.55-all-dev,但是我是用的是ubuntu16.04 LTS好像没这么低的版本,所以使用了libboost-all-dev替代
安装boost_1_60_0.tar.gz,这一步要好长时间
- wget http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz
- tar xvf boost_1_60_0.tar.gz
- cd boost_1_60_0
- ./bootstrap.sh
- sudo ./b2 install
下载thrift,
- download 地址
- tar thrift-0.10.0.tar.gz
- cd thrift-0.10.0.tar.gz
- ./configure && make
- sudo make install
检验thrift安装
root@ubuntu:/home/wasdns/thrift# thrift -version
Thrift version 1.0.0-dev
如果出错参考 http://www.cnblogs.com/qq952693358/p/6193842.html
一般我们在Linux下执行某些外部程序的时候可能会提示找不到共享库的错误, 比如:
tmux: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory原因一般有两个, 一个是操作系统里确实没有包含该共享库(lib.so.文件)或者共享库版本不对, 遇到这种情况那就去网上下载并安装上即可.
另外一个原因就是已经安装了该共享库, 但执行需要调用该共享库的程序的时候, 程序按照默认共享库路径找不到该共享库文件.
root@ubuntu:/home/wasdns/thrift# cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf root@ubuntu:/home/wasdns/thrift# echo "/usr/local/lib" >> /etc/ld.so.conf
root@ubuntu:/home/wasdns/thrift# cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf /usr/local/lib
root@ubuntu:/home/wasdns/thrift# ldconfig
root@ubuntu:/home/wasdns/thrift# thrift -version
Thrift version 1.0.0-dev
安装完成后到hbase的目录下,找到Hbase.thrift,该文件一般在hbase目录下的src/main/resources/org/apache/hadoop/hbase/thrift。如果没有,那么下载响应的源码安装包,把其中的hbase-thrift目录下的src复制到hbase目录下。
- thrift --gen py Hbase.thrift 会生成gen-py文件夹,将其修改成hbase
- sudo pip install thrift 安装python的thrift库
- bin/hbase-daemon.sh start thrift 启动hbase的thrift服务,默认端口是9090
- 创建hbase表
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('localhost', 9090); transport = TTransport.TBufferedTransport(transport) protocol = TBinaryProtocol.TBinaryProtocol(transport); client = Hbase.Client(protocol)
transport.open() contents = ColumnDescriptor(name='cf:', maxVersions=1)
client.createTable('test', [contents]) print client.getTableNames()
执行代码,成功后,进入hbase的shell,用命令list可以看到刚刚的test表已经创建成功。
python thrift hbase安装连接的更多相关文章
- 【hbase】使用thrift with python 访问HBase
HBase 版本: 0.98.6 thrift 版本: 0.9.0 使用 thrift client with python 连接 HBase 报错: Traceback (most recent ...
- ambari安装集群下python连接hbase之安装thrift
简介: python连接hbase是需要通过thrift连进行连接的,ambari安装的服务中貌似没有自带安装hbase的thrift,我是看配置hbase的配置名称里面没有thrift,cdh版本的 ...
- Hbase理论&&hbase shell&&python操作hbase&&python通过mapreduce操作hbase
一.Hbase搭建: 二.理论知识介绍: 1Hbase介绍: Hbase是分布式.面向列的开源数据库(其实准确的说是面向列族).HDFS为Hbase提供可靠的底层数据存储服务,MapReduce为Hb ...
- python操作Hbase
本地操作 启动thrift服务:./bin/hbase-daemon.sh start thrift hbase模块产生: 下载thrfit源码包:thrift-0.8.0.tar.gz 解压安装 . ...
- python 操作 hbase
python 是万能的,当然也可以通过api去操作big database 的hbase了,python是通过thrift去访问操作hbase 以下是在centos7 上安装操作,前提是hbase已经 ...
- python连接hbase
安装HBase HBase是一个构建在HDFS上的分布式列存储系统,主要用于海量结构化数据存储.这里,我们的目标只是为Python访问HBase提供一个基本的环境,故直接下载二进制包,采用单机安装.下 ...
- 【Hbase三】Java,python操作Hbase
Java,python操作Hbase 操作Hbase python操作Hbase 安装Thrift之前所需准备 安装Thrift 产生针对Python的Hbase的API 启动Thrift服务 执行p ...
- Python Thrift 简单示例
本文基于Thrift-0.10,使用Python实现服务器端,使用Java实现客户端,演示了Thrift RPC调用示例.Java客户端提供两个字符串参数,Python服务器端计算这两个字符串的相似度 ...
- python thrift使用实例
前言 Apache Thrift 是 Facebook 实现的一种高效的.支持多种编程语言的远程服务调用的框架.本文将从 Python开发人员角度简单介绍 Apache Thrift 的架构.开发和使 ...
随机推荐
- this.$router.push() 在新窗口怎么打开
参考:https://blog.csdn.net/qyl_0316/article/details/86550361
- Java EE 学习(3):IDEA + maven 搭建 web(1)
摘要: 主要讲解使用 IDEA 开发 Spring MVC 的环境搭建,Maven的简单教学. 参考1:https://my.oschina.net/gaussik/blog/385697 参考2:h ...
- react 当中重新渲染dom的方法
有个upload 重复上传同名文件的需求,在网上找了很多解决方案都不好使,在react当中解决该问题其实很简单,其实无法上传同名文件 的原因是因为无法触发onChange事件,只需要刷新改dom就可以 ...
- python没学好
环境 装东西用pip3不是pip 运算 //是下取整 py的浮点数也没有大小限制,但是超出一定范围就直接表示为inf 条件语句与循环 if xxx:, elif:, else:, 'for x in ...
- 教你怎么使用Windows7系统自带的备份与还原的方法
原文发布时间为:2010-09-09 -- 来源于本人的百度文章 [由搬家工具导入] 继续单击“下一步”按钮,在其后界面中检查上述备份设置是否正确,如果不正确的话可以直接单击“取消”按钮,重新设置备份 ...
- 01.mp4v2应用—mp4转h264
1.h264文件基本功能 NAL 头 0x00 0x00 0x00 0x01 sps :nal+0x67开头 pps :nal+0x68开头 I帧 0x65 开头 ...... 2.mp4v2提取26 ...
- java实现udp发送端和接收端
发送端: package demo02; import java.io.IOException; import java.net.DatagramPacket; import java.net.Dat ...
- win7 64位数据库连接问题:在指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配
通过ODBC/JDBC连接程序和数据库时,异常报错“在指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配”的解决办法 本机:64位win7,64位JDK,做Web实验用32位myeclipse ...
- NOIP 2016 天天爱跑步 80分暴力
题目描述 小c同学认为跑步非常有趣,于是决定制作一款叫做<天天爱跑步>的游戏.«天天爱跑步»是一个养成类游戏,需要玩家每天按时上线,完成打卡任务. 这个游戏的地图可以看作一一棵包含 个结点 ...
- 树(tree)
树(tree)[题目描述]从前在森林里面有一棵很大的树,树上住着很多小动物.树上有