Database Reference
In-Depth Information
# Put Data in HBase using thrift client
client.put(table, put)
# Create the GET call
get = TGet(row="row-1")
print "Retrieving Data :", get
# Retrieve Data from HBase using thrift client
result = client.get(table, get)
print "Result:", result
#Closing socket connection with HBase
transport.close()
To run the preceding Python example, perform the following steps:
1.
Run Thrift to generate the Python module for HBase as follows:
thrift --gen py ../../../../../hbase-server/src/main/resources/
org/apache/hadoop/hbase/thrift2/hbase.thrift
2. Create a directory containing the preceding Python program ile and the
directory, gen-py/hbase , generated in step 1.
3.
Install the Python thrift library using the following command:
pip install thrift==0.9.0
4.
Create a table called, tab1 , with a family called cf1 using the HBase shell.
5.
Start the HBase thrift2 server using the following command:
bin/hbase thrift2 start
6.
Execute the program.
The Hadoop ecosystem client
So far, we discussed that HBase clients which work in the interactive mode are
synchronous in nature. For batch processing that runs background work such as
building search indexes, building statistical data for reporting needs, and so on,
a Hadoop ecosystem client such as Hive is used.
 
Search WWH ::




Custom Search