I started to play with HBase recently and decided to keep a log of what worked for me.
HBase version: hbase-0.90.2
Jython version: Jython 2.5.2
1. Install Jython, HBase
2. Setting up the classpath for hbase. The commands described on the HBase wiki worked fine for me with some minor changes.
-bash-4.1$ cd hbase-0.90.2
-bash-4.1$ ps auwx|grep java|grep org.apache.hadoop.hbase.master.HMaster|sed -r "s/.+?classpath //" | sed -r "s/ .+?//"
copy the classpath and
-bash-4.1$ export CLASSPATH=$coppied_class_path
3. Start jyphon. Since it’s quite a long line, I just made an alias for it:
-bash-4.1$ alias pyhbase='HBASE_OPTS="-Dpython.path=$JYTHON_HOME" HBASE_CLASSPATH=$JYTHON_HOME/jython.jar $HBASE_HOME/bin/hbase org.python.util.jython'
where the $JYTHON_HOME, $HBASE_HOME, as well as the $CLASSPATH and the alias can be stored in the ~/.profile file (for bash).
The jython shell appears:
-bash-4.1$ pyhbase Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06) [Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_20 Type "help", "copyright", "credits" or "license" for more information. >>>
To run a jython script:
-bash-4.1$ pyhbase jython_script
http://hbase.apache.org/book/quickstart.html (quick start with HBase)
http://hbase.apache.org/book/notsoquick.html (more complicated setting up for HBase)
http://wiki.apache.org/hadoop/Hbase/Jython (Using Jython to interact with HBase)