Friday, 18 August 2017

How to add DEBUG for hbase shell?


Test is performed in a MapR cluster.

To enable DEBUG in 'hbase shell', make the following change:

Inside '/opt/mapr/hbase/hbase-<version>/bin/hbase' file
Change : export HBASE_ROOT_LOGGER="INFO,DRFA"
to : export HBASE_ROOT_LOGGER="DEBUG,console" 
in 'if [ "$COMMAND" = "shell" ] ; then' section.

Sample is given below:


# figure out which class to run
if [ "$COMMAND" = "shell" ] ; then
  # send hbase shell log messages to the log file
  export HBASE_LOGFILE="hbase-${HBASE_IDENT_STRING}-shell-${HOSTNAME}.log"
  export HBASE_ROOT_LOGGER="DEBUG,console"
  # eg export JRUBY_HOME=/usr/local/share/jruby
  if [ "$JRUBY_HOME" != "" ] ; then
    CLASSPATH="$JRUBY_HOME/lib/jruby.jar:$CLASSPATH"
    HBASE_OPTS="$HBASE_OPTS -Djruby.home=$JRUBY_HOME -Djruby.lib=$JRUBY_HOME/lib"
  fi
        #find the hbase ruby sources
  if [ -d "$HBASE_HOME/lib/ruby" ]; then
    HBASE_OPTS="$HBASE_OPTS -Dhbase.ruby.sources=$HBASE_HOME/lib/ruby"
  else
    HBASE_OPTS="$HBASE_OPTS -Dhbase.ruby.sources=$HBASE_HOME/hbase-shell/src/main/ruby"
  fi
  HBASE_OPTS="$HBASE_OPTS $HBASE_SHELL_OPTS"
  CLASS="log4j.logger.org.jruby.Main -X+O ${JRUBY_OPTS} ${HBASE_HOME}/bin/hirb.rb"

No comments:

Post a Comment