下载thrift
通过网盘分享的文件:thrift-0.9.3.tar.gz
链接: https://pan.baidu.com/s/1dQ3QJu5N2exSKtHlSS7aWQ 提取码: tc4c
解压thrift到src文件夹下
安装Thrift依赖库
yum install automakelibtoolflex bison pkgconfiggcc-c++ boost-devellibevent-develzlib-develpython-develruby-developenssl-devel yum install boost-devel.x86_64
yum install libevent-devel.x86_64
编译源码包
进入thrift解压后的目录下
1、执行:
./configure --with-cpp=no --with-ruby=no
- 遇到报错:
configure: error: in `/usr/local/src/thrift-0.9.3’:
configure: error: no acceptable C c
检查gcc是否安装
gcc --version
安装gcc
sudo yum groupinstall “Development Tools”
2、执行:
make -j 4
3、执行:
make install
产生针对Python的Hbase的API
下载hbase源码包:
wget http://archive.apache.org/dist/hbase/0.98.24/hbase-0.98.24-src.tar.gz
下载后解压,并进入解压后的目录下
# 查找文件
find . -name Hbase.thrift
# 得到
./hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrif
# 进入该目录
cd ./hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/
# 生成 python 接口
thrift -gen py Hbase.thrift
# 查看生成的接口文件
ls # 生成了一个目录 gen-py
# 复制接口文件到需要应用的地方
cp -raf gen-py/hbase /home/zzh/hbase_test
启动 Thrift 服务
# 进入hbase安装目录
[root@master hbase-1.3.6]# cd bin/
# 启动 thrift 服务
hbase-daemon.sh start thrift
解决报错
- thrift模块无法导入,模块不存在:
1.使用pip list查看列表中有没有thrift的库,若没有安装:
pip install thrift
pip install hbase-thrift
2.重启ThriftServer:
jps
kill -9 pid
进入hbase安装目录
cd bin/
hbase-daemon.sh start thrift - pip未找到命令:
1.下载上传通过网盘分享的文件:get-pip.py
链接: https://pan.baidu.com/s/1RLYsc4juys98kqIZgtnT4A 提取码: m14a
2.执行 python get-pip.py 命令,从而安装下载安装pip
参考文献:【已解决】 linux下提示:pip未找到命令