安裝ApacheThrift網(wǎng)關(guān)到CentOS2

1、生成 python用的thrift模塊

民權(quán)網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,民權(quán)網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為民權(quán)成百上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的民權(quán)做網(wǎng)站的公司定做!

thrift --gen py /src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift

(該路徑是從hbase的源代碼文件中來(lái)的)

這樣會(huì)在當(dāng)前路徑生成一個(gè)gen-py路徑

2、安裝

cd gen-py/hbase

python *.py build

python *.py install

cd ..

cp-rhbase/usr/lib/python2.6/site-packages/

3、測(cè)試

python

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.137.101',9090)

transport = TTransport.TBufferedTransport(transport)

protocol = TBinaryProtocol.TBinaryProtocol(transport)

client = Hbase.Client(protocol)

transport.open()

scan = TScan()

tableName = 'ttable'

id = client.scannerOpenWithScan(tableName, scan, None)

result1 = client.scannerGetList(id, 10)

print result1

4、不要忘記啟動(dòng)thrift守護(hù)進(jìn)程

./bin/hbase-daemon.sh start thrift

文章題目:安裝ApacheThrift網(wǎng)關(guān)到CentOS2
轉(zhuǎn)載注明:http://muchs.cn/article42/ppjsec.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供搜索引擎優(yōu)化、定制開(kāi)發(fā)、服務(wù)器托管、網(wǎng)站維護(hù)、云服務(wù)器手機(jī)網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)