In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Generate thrift module for python
Thrift-gen py / src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
(the path is from the source code file of hbase)
This generates a gen-py path on the current path
2. Installation
Cd gen-py/hbase
Python * .py build
Python * .py install
Cd..
Cp-rhbase/usr/lib/python2.6/site-packages/
3. Testing
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)
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
Don't forget to start the thrift daemon
. / bin/hbase-daemon.sh start thrift
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.