diff --git a/bin/hbase b/bin/hbase index f079b30..3348cda 100755 --- a/bin/hbase +++ b/bin/hbase @@ -72,6 +72,9 @@ fi COMMAND=$1 shift +ACTION=$1 +shift + # Source the hbase-env.sh. Will have JAVA_HOME defined. if [ -f "${HBASE_CONF_DIR}/hbase-env.sh" ]; then . "${HBASE_CONF_DIR}/hbase-env.sh" @@ -188,8 +191,14 @@ if [ "$COMMAND" = "shell" ] ; then CLASS="org.jruby.Main ${HBASE_HOME}/bin/hirb.rb" elif [ "$COMMAND" = "master" ] ; then CLASS='org.apache.hadoop.hbase.master.HMaster' + if [ "$ACTION" = "start" ] ; then + HBASE_OPTS="$HBASE_OPTS $HBASE_MASTER_OPTS" + fi elif [ "$COMMAND" = "regionserver" ] ; then CLASS='org.apache.hadoop.hbase.regionserver.HRegionServer' + if [ "$ACTION" = "start" ] ; then + HBASE_OPTS="$HBASE_OPTS $HBASE_REGIONSERVER_OPTS" + fi elif [ "$COMMAND" = "rest" ] ; then CLASS='org.apache.hadoop.hbase.rest.Dispatcher' elif [ "$COMMAND" = "thrift" ] ; then @@ -216,4 +225,4 @@ if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then fi # run it -exec "$JAVA" $JAVA_HEAP_MAX $HBASE_OPTS -classpath "$CLASSPATH" $CLASS "$@" +exec "$JAVA" $JAVA_HEAP_MAX $HBASE_OPTS -classpath "$CLASSPATH" $CLASS "$ACTION" "$@" diff --git a/conf/hadoop-metrics.properties b/conf/hadoop-metrics.properties index 5fcaaa6..dcbcff4 100644 --- a/conf/hadoop-metrics.properties +++ b/conf/hadoop-metrics.properties @@ -11,6 +11,10 @@ # Configuration of the "hbase" context for null hbase.class=org.apache.hadoop.metrics.spi.NullContext +# Configuration of the "hbase" context for JMX +# hbase.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread +# hbase.period=60 + # Configuration of the "hbase" context for file # hbase.class=org.apache.hadoop.hbase.metrics.file.TimeStampingFileContext # hbase.period=10 @@ -26,6 +30,10 @@ hbase.class=org.apache.hadoop.metrics.spi.NullContext # Configuration of the "jvm" context for null jvm.class=org.apache.hadoop.metrics.spi.NullContext +# Configuration of the "jvm" context for JMX +# jvm.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread +# jvm.period=60 + # Configuration of the "jvm" context for file # jvm.class=org.apache.hadoop.hbase.metrics.file.TimeStampingFileContext # jvm.period=10 @@ -41,6 +49,10 @@ jvm.class=org.apache.hadoop.metrics.spi.NullContext # Configuration of the "rpc" context for null rpc.class=org.apache.hadoop.metrics.spi.NullContext +# Configuration of the "rpc" context for JMX +# rpc.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread +# rpc.period=60 + # Configuration of the "rpc" context for file # rpc.class=org.apache.hadoop.hbase.metrics.file.TimeStampingFileContext # rpc.period=10 diff --git a/conf/hbase-env.sh b/conf/hbase-env.sh index 0c84981..0987219 100644 --- a/conf/hbase-env.sh +++ b/conf/hbase-env.sh @@ -30,6 +30,15 @@ # The maximum amount of heap to use, in MB. Default is 1000. # export HBASE_HEAPSIZE=1000 +# Additional configuration for enabling remote JMX monitoring +# By default no JMX configuration is used. For full details on configuring +# remote access see: +# http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html +#JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false" +#JMX_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote.password.file=/path/to/jmxremote.password" +#JMX_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote.access.file=/path/to/jmxremote.access" +JMX_OPTS="" + # Extra Java runtime options. # Below are what we set by default. May only work with SUN JVM. # For more on why as well as other possible settings, @@ -39,6 +48,12 @@ export HBASE_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+ # Uncomment below to enable java garbage collection logging. #export HBASE_OPTS="$HBASE_OPTS -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:$HBASE_HOME/logs/gc-hbase.log" +# Additional Java runtime options passed to the HBase Master process +export HBASE_MASTER_OPTS="$JMX_OPTS" + +# Additional Java runtime options passed to the HBase Regionserver processes +export HBASE_REGIONSERVER_OPTS="$JMX_OPTS" + # File naming hosts on which HRegionServers will run. $HBASE_HOME/conf/regionservers by default. # export HBASE_REGIONSERVERS=${HBASE_HOME}/conf/regionservers