3 * org.apache.hadoop.hbase.mapreduce.SampleUploader
4 Demonstrates uploading data from text files (presumably stored in HDFS) to HBase.
6 * org.apache.hadoop.hbase.mapreduce.IndexBuilder
7 Demonstrates map/reduce with a table as the source and other tables as the sink.
8 You can generate sample data for this MR job via hbase-examples/src/main/ruby/index-builder-setup.rb.
12 Sample clients of the HBase ThriftServer. They perform the same actions, implemented in
13 C++, Java, Ruby, PHP, Perl, and Python. Pre-generated Thrift code for HBase is included
14 to be able to compile/run the examples without Thrift installed.
15 If desired, the code can be re-generated as follows:
16 thrift --gen cpp --gen java --gen rb --gen py --gen php --gen perl \
17 ${HBASE_ROOT}/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
18 and re-placed at the corresponding paths. You should not have to do this generally.
20 Before you run any Thrift examples, find a running HBase Thrift server (and a running
21 hbase cluster for this server to talk to -- at a minimum start a standalone instance
22 by doing ./bin/start-hbase.sh). If you start one locally (bin/hbase thrift start),
23 the default port is 9090 (a webserver with basic stats defaults showing on port 9095).
25 * Java: org.apache.hadoop.hbase.thrift.DemoClient (jar under lib/).
26 1. Make sure your client has all required jars on the CLASSPATH when it starts. If lazy,
27 just add all jars as follows: {HBASE_EXAMPLE_CLASSPATH=`./bin/hbase classpath`}
28 2. If HBase server is not secure, or authentication is not enabled for the Thrift server, execute:
29 {java -cp hbase-examples-[VERSION].jar:${HBASE_EXAMPLE_CLASSPATH} org.apache.hadoop.hbase.thrift.DemoClient <host> <port>}
30 3. If HBase server is secure, and authentication is enabled for the Thrift server, run kinit at first, then execute:
31 {java -cp hbase-examples-[VERSION].jar:${HBASE_EXAMPLE_CLASSPATH} org.apache.hadoop.hbase.thrift.DemoClient <host> <port> true <server-principal>}
32 <server-principal> should only be specified when the client connects to a secure cluster. It's default value is "hbase".
33 4. Here is a lazy example that just pulls in all hbase dependency jars and that goes against default location on localhost.
34 It should work with a standalone hbase instance started by doing ./bin/start-hbase.sh:
35 {java -cp ./hbase-examples/target/hbase-examples-2.0.0-SNAPSHOT.jar:`./bin/hbase classpath` org.apache.hadoop.hbase.thrift.DemoClient localhost 9090}
37 * Ruby: hbase-examples/src/main/ruby/DemoClient.rb
38 1. Modify the import path in the file to point to {$THRIFT_HOME}/lib/rb/lib.
39 2. Execute {ruby DemoClient.rb} (or {ruby DemoClient.rb <host> <port>}).
41 * Python: hbase-examples/src/main/python/DemoClient.py
42 1. Modify the added system path in the file to point to {$THRIFT_HOME}/lib/py/build/lib.[YOUR SYSTEM]
43 2. Execute {python DemoClient.py <host> <port>}.
45 * PHP: hbase-examples/src/main/php/DemoClient.php
46 1. Modify the THRIFT_HOME path in the file to point to actual {$THRIFT_HOME}.
47 2. Execute {php DemoClient.php}.
48 3. Starting from Thrift 0.9.0, if Thrift.php complains about some files it cannot include, go to thrift root,
49 and copy the contents of php/lib/Thrift under lib/php/src. Thrift.php appears to include, from under the same root,
50 both TStringUtils.php, only present in src/, and other files only present under lib/; this will bring them under
52 If you know better about PHP and Thrift, please feel free to fix this.
54 * Perl: hbase-examples/src/main/perl/DemoClient.pl
55 1. Modify the "use lib" path in the file to point to {$THRIFT_HOME}/lib/perl/lib.
56 2. Use CPAN to get Bit::Vector and Class::Accessor modules if not present (see thrift perl README if more modules are missing).
57 3. Execute {perl DemoClient.pl}.
59 * CPP: hbase-examples/src/main/cpp/DemoClient.cpp
60 1. Make sure you have Thrift C++ libraries; modify Makefile if necessary.
61 The recent (0.14.1 as of this writing) version of Thrift can be downloaded from http://thrift.apache.org/download/.
63 3. Execute {./DemoClient <host> <port>}.
66 This maven module has core protobuf definition files ('.protos') used by hbase
69 Generation of java files from protobuf .proto files included here is done as