Index: src/assembly/all.xml =================================================================== --- src/assembly/all.xml (revision 1078100) +++ src/assembly/all.xml (working copy) @@ -50,6 +50,14 @@ target/site docs + + src/packages + sbin + 755 + + update-hbase-env.sh + + Index: src/packages/update-hbase-env.sh =================================================================== --- src/packages/update-hbase-env.sh (revision 0) +++ src/packages/update-hbase-env.sh (revision 0) @@ -0,0 +1,193 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script configures hbase-env.sh and symlinkis directories for +# relocating RPM locations. + +usage() { + echo " +usage: $0 + Required parameters: + --prefix=PREFIX path to install into + + Optional parameters: + --arch=i386 OS Architecture + --bin-dir=PREFIX/bin Executable directory + --conf-dir=/etc/hbase Configuration directory + --log-dir=/var/log/hbase Log directory + --pid-dir=/var/run PID file location + " + exit 1 +} + +OPTS=$(getopt \ + -n $0 \ + -o '' \ + -l 'arch:' \ + -l 'prefix:' \ + -l 'bin-dir:' \ + -l 'conf-dir:' \ + -l 'lib-dir:' \ + -l 'log-dir:' \ + -l 'pid-dir:' \ + -l 'uninstall' \ + -- "$@") + +if [ $? != 0 ] ; then + usage +fi + +eval set -- "${OPTS}" +while true ; do + case "$1" in + --arch) + ARCH=$2 ; shift 2 + ;; + --prefix) + PREFIX=$2 ; shift 2 + ;; + --bin-dir) + BIN_DIR=$2 ; shift 2 + ;; + --log-dir) + LOG_DIR=$2 ; shift 2 + ;; + --lib-dir) + LIB_DIR=$2 ; shift 2 + ;; + --conf-dir) + CONF_DIR=$2 ; shift 2 + ;; + --pid-dir) + PID_DIR=$2 ; shift 2 + ;; + --uninstall) + UNINSTALL=1; shift + ;; + --) + shift ; break + ;; + *) + echo "Unknown option: $1" + usage + exit 1 + ;; + esac +done + +for var in PREFIX; do + if [ -z "$(eval "echo \$$var")" ]; then + echo Missing param: $var + usage + fi +done + +ARCH=${ARCH:-i386} +BIN_DIR=${BIN_DIR:-$PREFIX/share/hbase/bin} +CONF_DIR=${CONF_DIR:-$PREFIX/conf} +LIB_DIR=${LIB_DIR:-$PREFIX/lib} +LOG_DIR=${LOG_DIR:-$PREFIX/var/log} +PID_DIR=${PID_DIR:-$PREFIX/var/run} +UNINSTALL=${UNINSTALL:-0} + +if [ "${ARCH}" != "i386" ]; then + LIB_DIR=${LIB_DIR}64 +fi + +. /etc/default/hadoop-env.sh +. /etc/default/zookeeper-env.sh + +if [ "${UNINSTALL}" -eq "1" ]; then + # Remove symlinks + if [ "${BIN_DIR}" != "${PREFIX}/share/hbase/bin" ]; then + for var in `ls ${PREFIX}/share/hbase/bin`; do + rm -f ${BIN_DIR}/${var} + done + fi + if [ -f /etc/default/hbase-env.sh ]; then + rm -f /etc/default/hbase-env.sh + fi + if [ "${CONF_DIR}" != "${PREFIX}/share/hbase/conf" ]; then + rm -f ${PREFIX}/share/hbase/conf + fi + + rm -f ${PREFIX}/share/hbase/sbin/hbase-master + rm -f ${PREFIX}/share/hbase/sbin/hbase-regionserver + rm -f /etc/init.d/hbase-master + rm -f /etc/init.d/hbase-regionserver + +else + # Create symlinks + if [ "${BIN_DIR}" != "${PREFIX}/share/hbase/bin" ]; then + for var in `ls ${PREFIX}/share/hbase/bin`; do + ln -sf ${PREFIX}/share/hbase/bin/${var} ${BIN_DIR}/${var} + done + fi + if [ "${CONF_DIR}" != "${PREFIX}/share/hbase/conf" ]; then + ln -sf ${CONF_DIR} ${PREFIX}/share/hbase/conf + fi + + chmod 755 ${PREFIX}/share/hbase/sbin/* + + ln -sf ${PREFIX}/share/hbase/sbin/hbase-master /etc/init.d/hbase-master + ln -sf ${PREFIX}/share/hbase/sbin/hbase-regionserver /etc/init.d/hbase-regionserver + + ln -sf ${CONF_DIR}/hbase-env.sh /etc/default/hbase-env.sh + ln -sf ${CONF_DIR}/hbase-env.sh /etc/profile.d/hbase-env.sh + + if [ -d ${HADOOP_HOME} ]; then + HADOOP_JARS=`ls ${HADOOP_HOME}/*.jar | tr '\n' ':'` + fi + + if [ -d ${ZOOKEEPER_HOME}/share/zookeeper ]; then + ZOOKEEPER_JARS=`ls ${ZOOKEEPER_HOME}/share/zookeeper/*.jar | tr '\n' ':'` + fi + + mkdir -p ${PID_DIR} + mkdir -p ${LOG_DIR} + chown hbase ${PID_DIR} + chown hbase ${LOG_DIR} + + TFILE="/tmp/$(basename $0).$$.tmp" + grep -v "^export HBASE_HOME" ${CONF_DIR}/hbase-env.sh | \ + grep -v "^export HBASE_CONF_DIR" | \ + grep -v "^export HBASE_CLASSPATH" | \ + grep -v "^export HBASE_MANAGES_ZK" | \ + grep -v "^export HBASE_IDENT_STRING" | \ + grep -v "^export HBASE_PID_DIR" | \ + grep -v "^export HBASE_LOG_DIR" | \ + grep -v "^export JAVA_HOME" > ${TFILE} + if [ -z "${JAVA_HOME}" ]; then + if [ -e /etc/lsb-release ]; then + JAVA_HOME=`update-alternatives --config java | grep java | cut -f2 -d':' | cut -f2 -d' ' | sed -e 's/\/bin\/java//'` + else + JAVA_HOME=/usr/java/default + fi + fi + if [ "${JAVA_HOME}xxx" != "xxx" ]; then + echo "export JAVA_HOME=${JAVA_HOME}" >> ${TFILE} + fi + echo "export HBASE_IDENT_STRING=\`whoami\`" >> ${TFILE} + echo "export HBASE_HOME=${PREFIX}/share/hbase" >> ${TFILE} + echo "export HBASE_CONF_DIR=${CONF_DIR}" >> ${TFILE} + echo "export HBASE_CLASSPATH=${CONF_DIR}:${HADOOP_CONF_DIR}:${HADOOP_JARS}:${ZOOKEEPER_JARS}" >> ${TFILE} + echo "export HBASE_MANAGES_ZK=false" >> ${TFILE} + echo "export HBASE_PID_DIR=${PID_DIR}" >> ${TFILE} + echo "export HBASE_LOG_DIR=${LOG_DIR}" >> ${TFILE} + cp ${TFILE} ${CONF_DIR}/hbase-env.sh + rm -f ${TFILE} +fi Property changes on: src/packages/update-hbase-env.sh ___________________________________________________________________ Added: svn:executable + * Index: src/packages/conf-pseudo/hbase-site.xml =================================================================== --- src/packages/conf-pseudo/hbase-site.xml (revision 0) +++ src/packages/conf-pseudo/hbase-site.xml (revision 0) @@ -0,0 +1,68 @@ + + + + + + hbase.rootdir + hdfs://localhost:9000/hbase + + + hbase.cluster.distributed + true + The mode the cluster will be in. Possible values are + false: standalone and pseudo-distributed setups with managed Zookeeper + true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh) + + + + hbase.zookeeper.property.clientPort + 2181 + Property from ZooKeeper's config zoo.cfg. + The port at which the clients will connect. + + + + dfs.replication + 1 + The replication count for HLog and HFile storage. Should not be greater than HDFS datanode count. + + + + hbase.zookeeper.quorum + localhost + Comma separated list of servers in the ZooKeeper Quorum. + For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com". + By default this is set to localhost for local and pseudo-distributed modes + of operation. For a fully-distributed setup, this should be set to a full + list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh + this is the list of servers which we will start/stop ZooKeeper on. + + + + hbase.zookeeper.property.dataDir + /var/lib/zookeeper/data + Property from ZooKeeper's config zoo.cfg. + The directory where the snapshot is stored. + + + Index: src/packages/deb/hbase.control/control =================================================================== --- src/packages/deb/hbase.control/control (revision 0) +++ src/packages/deb/hbase.control/control (revision 0) @@ -0,0 +1,9 @@ +Package: hbase +Version: @version@ +Section: misc +Priority: optional +Architecture: all +Depends: openjdk-6-jre-headless, hadoop, zookeeper +Maintainer: Apache Software Foundation +Description: HBase is the Hadoop database. Use it when you need random, realtime read/write access to your Big Data. This project's goal is the hosting of very large tables -- billions of rows X millions of columns -- atop clusters of commodity hardware. +Distribution: development Index: src/packages/deb/hbase.control/postinst =================================================================== --- src/packages/deb/hbase.control/postinst (revision 0) +++ src/packages/deb/hbase.control/postinst (revision 0) @@ -0,0 +1,24 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +bash /usr/share/hbase/sbin/update-hbase-env.sh \ + --prefix=/usr \ + --bin-dir=/usr/bin \ + --conf-dir=/etc/hbase \ + --log-dir=/var/log/hbase \ + --pid-dir=/var/run/hbase + Property changes on: src/packages/deb/hbase.control/postinst ___________________________________________________________________ Added: svn:executable + * Index: src/packages/deb/hbase.control/preinst =================================================================== --- src/packages/deb/hbase.control/preinst (revision 0) +++ src/packages/deb/hbase.control/preinst (revision 0) @@ -0,0 +1,21 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +getent group hadoop 2>/dev/null >/dev/null || /usr/sbin/groupadd -r hadoop + +/usr/sbin/useradd --comment "HBase" --shell /bin/bash -M -r --groups hadoop --home /usr/share/hbase hbase 2> /dev/null || : + Property changes on: src/packages/deb/hbase.control/preinst ___________________________________________________________________ Added: svn:executable + * Index: src/packages/deb/hbase.control/postrm =================================================================== --- src/packages/deb/hbase.control/postrm (revision 0) +++ src/packages/deb/hbase.control/postrm (revision 0) @@ -0,0 +1,20 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +/usr/sbin/userdel hbase 2> /dev/null >/dev/null +exit 0 + Property changes on: src/packages/deb/hbase.control/postrm ___________________________________________________________________ Added: svn:executable + * Index: src/packages/deb/hbase.control/prerm =================================================================== --- src/packages/deb/hbase.control/prerm (revision 0) +++ src/packages/deb/hbase.control/prerm (revision 0) @@ -0,0 +1,27 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +/etc/init.d/hbase-master stop 2>/dev/null >/dev/null +/etc/init.d/hbase-regionserver stop 2>/dev/null >/dev/null +bash /usr/share/hbase/sbin/update-hbase-env.sh \ + --prefix=/usr \ + --bin-dir=/usr/bin \ + --conf-dir=/etc/hbase \ + --log-dir=/var/log/hbase \ + --pid-dir=/var/run/hbase \ + --uninstal + Property changes on: src/packages/deb/hbase.control/prerm ___________________________________________________________________ Added: svn:executable + * Index: src/packages/deb/hbase.control/conffile =================================================================== --- src/packages/deb/hbase.control/conffile (revision 0) +++ src/packages/deb/hbase.control/conffile (revision 0) @@ -0,0 +1,5 @@ +/etc/hbase/hadoop-metrics.properties +/etc/hbase/hbase-env.sh +/etc/hbase/hbase-site.xml +/etc/hbase/log4j.properties +/etc/hbase/regionservers Index: src/packages/deb/conf-pseudo.control/control =================================================================== --- src/packages/deb/conf-pseudo.control/control (revision 0) +++ src/packages/deb/conf-pseudo.control/control (revision 0) @@ -0,0 +1,9 @@ +Package: hbase-conf-pseudo +Version: @version@ +Section: misc +Priority: optional +Architecture: all +Depends: openjdk-6-jre-headless, hadoop, zookeeper, hbase +Maintainer: Apache Software Foundation +Description: HBase pseudo cluster configuration for single node cluster testing. +Distribution: development Index: src/packages/deb/conf-pseudo.control/postinst =================================================================== --- src/packages/deb/conf-pseudo.control/postinst (revision 0) +++ src/packages/deb/conf-pseudo.control/postinst (revision 0) @@ -0,0 +1,26 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +/etc/init.d/hadoop-namenode start 2>/dev/null >/dev/null +/etc/init.d/hadoop-datanode start 2>/dev/null >/dev/null +su - hdfs -c "hadoop fs -mkdir /hbase" 2>/dev/null >/dev/null +su - hdfs -c "hadoop fs -chown hbase /hbase" 2>/dev/null >/dev/null +/etc/init.d/hbase-master start 2>/dev/null >/dev/null +/etc/init.d/hbase-regionserver start 2>/dev/null >/dev/null +ln -sf ../init.d/hbase-master /etc/rc2.d/S94hbase-master +ln -sf ../init.d/hbase-regionserver /etc/rc6.d/S94hbase-regionserver + Property changes on: src/packages/deb/conf-pseudo.control/postinst ___________________________________________________________________ Added: svn:executable + * Index: src/packages/deb/conf-pseudo.control/prerm =================================================================== --- src/packages/deb/conf-pseudo.control/prerm (revision 0) +++ src/packages/deb/conf-pseudo.control/prerm (revision 0) @@ -0,0 +1,21 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +/etc/init.d/hbase-regionserver stop 2>/dev/null >/dev/null +/etc/init.d/hbase-master stop 2>/dev/null >/dev/null +rm -f /etc/rc2.d/S94hbase-master +rm -f /etc/rc2.d/S94hbase-regionserver Property changes on: src/packages/deb/conf-pseudo.control/prerm ___________________________________________________________________ Added: svn:executable + * Index: src/packages/deb/conf-pseudo.control/conffile =================================================================== --- src/packages/deb/conf-pseudo.control/conffile (revision 0) +++ src/packages/deb/conf-pseudo.control/conffile (revision 0) @@ -0,0 +1 @@ +/etc/hbase/hbase-site.xml Index: src/packages/deb/init.d/hbase-regionserver =================================================================== --- src/packages/deb/init.d/hbase-regionserver (revision 0) +++ src/packages/deb/init.d/hbase-regionserver (revision 0) @@ -0,0 +1,142 @@ +#! /bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +### BEGIN INIT INFO +# Provides: hbase-regionserver +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: Apache HBase Region Server +### END INIT INFO + +set -e + +# /etc/init.d/hbase-regionserver: start and stop the Apache HBase Region Server daemon + +test -x /usr/bin/hbase || exit 0 +( /usr/bin/hbase 2>&1 | grep -q hbase ) 2>/dev/null || exit 0 + +umask 022 + +if test -f /etc/default/hbase-env.sh; then + . /etc/default/hbase-env.sh +fi + +. /lib/lsb/init-functions + +# Are we running from init? +run_by_init() { + ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ] +} + +check_for_no_start() { + # forget it if we're trying to start, and /etc/hbase/hbase-regionserver_not_to_be_run exists + if [ -e /etc/hbase/hbase-regionserver_not_to_be_run ]; then + if [ "$1" = log_end_msg ]; then + log_end_msg 0 + fi + if ! run_by_init; then + log_action_msg "Apache HBase Region Server server not in use (/etc/hbase/hbase-regionserver_not_to_be_run)" + fi + exit 0 + fi +} + +check_privsep_dir() { + # Create the PrivSep empty dir if necessary + if [ ! -d ${HBASE_PID_DIR} ]; then + mkdir -p ${HBASE_PID_DIR} + chown root:hadoop ${HBASE_PID_DIR} + chmod 0775 ${HBASE_PID_DIR} + fi +} + +export PATH="${PATH:+$PATH:}/usr/sbin:/usr/bin" + +case "$1" in + start) + check_privsep_dir + check_for_no_start + log_daemon_msg "Starting Apache HBase Region Server server" "hbase-regionserver" + if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start regionserver; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping Apache HBase Region Server server" "hbase-regionserver" + if start-stop-daemon --stop --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + restart) + check_privsep_dir + log_daemon_msg "Restarting Apache HBase Region Server server" "hbase-regionserver" + start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid + check_for_no_start log_end_msg + if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start regionserver; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + try-restart) + check_privsep_dir + log_daemon_msg "Restarting Apache HBase Region Server server" "hbase-regionserver" + set +e + start-stop-daemon --stop --quiet --retry 30 --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid + RET="$?" + set -e + case $RET in + 0) + # old daemon stopped + check_for_no_start log_end_msg + if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start regionserver; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + 1) + # daemon not running + log_progress_msg "(not running)" + log_end_msg 0 + ;; + *) + # failed to stop + log_progress_msg "(failed to stop)" + log_end_msg 1 + ;; + esac + ;; + + status) + status_of_proc -p ${HBASE_PID_DIR}/hbase-hbase-regionserver.pid ${JAVA_HOME}/bin/java hbase-regionserver && exit 0 || exit $? + ;; + + *) + log_action_msg "Usage: /etc/init.d/hbase-regionserver {start|stop|restart|try-restart|status}" + exit 1 +esac + +exit 0 Property changes on: src/packages/deb/init.d/hbase-regionserver ___________________________________________________________________ Added: svn:executable + * Index: src/packages/deb/init.d/hbase-master =================================================================== --- src/packages/deb/init.d/hbase-master (revision 0) +++ src/packages/deb/init.d/hbase-master (revision 0) @@ -0,0 +1,142 @@ +#! /bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +### BEGIN INIT INFO +# Provides: hbase-master +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: Apache HBase Master +### END INIT INFO + +set -e + +# /etc/init.d/hbase-master: start and stop the Apache HBase Master daemon + +test -x /usr/bin/hbase || exit 0 +( /usr/bin/hbase 2>&1 | grep -q hbase ) 2>/dev/null || exit 0 + +umask 022 + +if test -f /etc/default/hbase-env.sh; then + . /etc/default/hbase-env.sh +fi + +. /lib/lsb/init-functions + +# Are we running from init? +run_by_init() { + ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ] +} + +check_for_no_start() { + # forget it if we're trying to start, and /etc/hbase/hbase-master_not_to_be_run exists + if [ -e /etc/hbase/hbase-master_not_to_be_run ]; then + if [ "$1" = log_end_msg ]; then + log_end_msg 0 + fi + if ! run_by_init; then + log_action_msg "Apache HBase Master server not in use (/etc/hbase/hbase-master_not_to_be_run)" + fi + exit 0 + fi +} + +check_privsep_dir() { + # Create the PrivSep empty dir if necessary + if [ ! -d ${HBASE_PID_DIR} ]; then + mkdir -p ${HBASE_PID_DIR} + chown root:hadoop ${HBASE_PID_DIR} + chmod 0775 ${HBASE_PID_DIR} + fi +} + +export PATH="${PATH:+$PATH:}/usr/sbin:/usr/bin" + +case "$1" in + start) + check_privsep_dir + check_for_no_start + log_daemon_msg "Starting Apache HBase Master server" "hbase-master" + if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start master; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping Apache HBase Master server" "hbase-master" + if start-stop-daemon --stop --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + restart) + check_privsep_dir + log_daemon_msg "Restarting Apache HBase Master server" "hbase-master" + start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid + check_for_no_start log_end_msg + if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start master; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + try-restart) + check_privsep_dir + log_daemon_msg "Restarting Apache HBase Master server" "hbase-master" + set +e + start-stop-daemon --stop --quiet --retry 30 --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid + RET="$?" + set -e + case $RET in + 0) + # old daemon stopped + check_for_no_start log_end_msg + if start-stop-daemon --start --quiet --oknodo --pidfile ${HBASE_PID_DIR}/hbase-hbase-master.pid -c hbase -x ${HBASE_HOME}/bin/hbase-daemon.sh -- --config ${HBASE_CONF_DIR} start master; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + 1) + # daemon not running + log_progress_msg "(not running)" + log_end_msg 0 + ;; + *) + # failed to stop + log_progress_msg "(failed to stop)" + log_end_msg 1 + ;; + esac + ;; + + status) + status_of_proc -p ${HBASE_PID_DIR}/hbase-hbase-master.pid ${JAVA_HOME}/bin/java hbase-master && exit 0 || exit $? + ;; + + *) + log_action_msg "Usage: /etc/init.d/hbase-master {start|stop|restart|try-restart|status}" + exit 1 +esac + +exit 0 Property changes on: src/packages/deb/init.d/hbase-master ___________________________________________________________________ Added: svn:executable + * Index: src/packages/build.xml =================================================================== --- src/packages/build.xml (revision 0) +++ src/packages/build.xml (revision 0) @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: src/packages/rpm/init.d/hbase-regionserver =================================================================== --- src/packages/rpm/init.d/hbase-regionserver (revision 0) +++ src/packages/rpm/init.d/hbase-regionserver (revision 0) @@ -0,0 +1,84 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Starts a HBase region server +# +# chkconfig: 2345 96 10 +# description: HBase region server + +source /etc/rc.d/init.d/functions +source /etc/default/hbase-env.sh + +RETVAL=0 +PIDFILE="${HBASE_PID_DIR}/hbase-hbase-regionserver.pid" +desc="HBase regionserver daemon" + +start() { + echo -n $"Starting $desc (hbase-regionserver): " + daemon --user hbase ${HBASE_HOME}/bin/hbase-daemon.sh --config "${HBASE_CONF_DIR}" start regionserver + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/hbase-regionserver + return $RETVAL +} + +stop() { + echo -n $"Stopping $desc (hbase-regionserver): " + daemon --user hbase ${HBASE_HOME}/bin/hbase-daemon.sh --config "${HBASE_CONF_DIR}" stop regionserver + RETVAL=$? + sleep 5 + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/hbase-regionserver $PIDFILE +} + +restart() { + stop + start +} + +checkstatus(){ + status -p $PIDFILE ${JAVA_HOME}/bin/java + RETVAL=$? +} + +condrestart(){ + [ -e /var/lock/subsys/hbase-regionserver ] && restart || : +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + checkstatus + ;; + restart) + restart + ;; + condrestart) + condrestart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart}" + exit 1 +esac + +exit $RETVAL Property changes on: src/packages/rpm/init.d/hbase-regionserver ___________________________________________________________________ Added: svn:executable + * Index: src/packages/rpm/init.d/hbase-master =================================================================== --- src/packages/rpm/init.d/hbase-master (revision 0) +++ src/packages/rpm/init.d/hbase-master (revision 0) @@ -0,0 +1,84 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Starts a HBase master +# +# chkconfig: 2345 95 10 +# description: HBase master + +source /etc/rc.d/init.d/functions +source /etc/default/hbase-env.sh + +RETVAL=0 +PIDFILE="${HBASE_PID_DIR}/hbase-hbase-master.pid" +desc="HBase master daemon" + +start() { + echo -n $"Starting $desc (hbase-master): " + daemon --user hbase ${HBASE_HOME}/bin/hbase-daemon.sh --config "${HBASE_CONF_DIR}" start master + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/hbase-master + return $RETVAL +} + +stop() { + echo -n $"Stopping $desc (hbase-master): " + daemon --user hbase ${HBASE_HOME}/bin/hbase-daemon.sh --config "${HBASE_CONF_DIR}" stop master + RETVAL=$? + sleep 5 + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/hbase-master $PIDFILE +} + +restart() { + stop + start +} + +checkstatus(){ + status -p $PIDFILE ${JAVA_HOME}/bin/java + RETVAL=$? +} + +condrestart(){ + [ -e /var/lock/subsys/hbase-master ] && restart || : +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + checkstatus + ;; + restart) + restart + ;; + condrestart) + condrestart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart}" + exit 1 +esac + +exit $RETVAL Property changes on: src/packages/rpm/init.d/hbase-master ___________________________________________________________________ Added: svn:executable + * Index: src/packages/rpm/spec/hbase.spec =================================================================== --- src/packages/rpm/spec/hbase.spec (revision 0) +++ src/packages/rpm/spec/hbase.spec (revision 0) @@ -0,0 +1,137 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# RPM Spec file for HBase version @version@ +# + +%define name hbase +%define version @version@ +%define release @package.release@ + +# Installation Locations +%define _source @package.name@ +%define _final_name @final.name@ +%define _prefix @package.prefix@ +%define _bin_dir %{_prefix}/bin +%define _conf_dir @package.conf.dir@ +%define _include_dir %{_prefix}/include +%define _lib_dir %{_prefix}/lib +%define _lib64_dir %{_prefix}/lib64 +%define _libexec_dir %{_prefix}/libexec +%define _log_dir @package.log.dir@ +%define _man_dir %{_prefix}/man +%define _pid_dir @package.pid.dir@ +%define _sbin_dir %{_prefix}/sbin +%define _share_dir %{_prefix}/share/hbase +%define _src_dir %{_prefix}/src +%define _var_dir %{_prefix}/var/lib + +# Build time settings +%define _build_dir @package.build.dir@ +%define _final_name @final.name@ +%define debug_package %{nil} + +Summary: Default HBase configuration templates +License: Apache License, Version 2.0 +URL: http://hbase.apache.org/ +Vendor: Apache Software Foundation +Group: Development/Libraries +Name: %{name} +Version: %{version} +Release: %{release} +Source0: %{_source} +Prefix: %{_prefix} +Prefix: %{_conf_dir} +Prefix: %{_log_dir} +Prefix: %{_pid_dir} +Buildroot: %{_build_dir} +Requires: sh-utils, textutils, /usr/sbin/useradd, /usr/sbin/usermod, /sbin/chkconfig, /sbin/service, jdk >= 1.6, hadoop +AutoReqProv: no +Provides: hbase + +%description +Installation of this RPM will setup your machine to run in pseudo-distributed mode where each HBase daemon runs in a separate Java process. + +%prep +%setup -n %{_final_name} + +%build +if [ -d ${RPM_BUILD_DIR}%{_prefix} ]; then + rm -rf ${RPM_BUILD_DIR}%{_prefix} +fi + +if [ -d ${RPM_BUILD_DIR}%{_log_dir} ]; then + rm -rf ${RPM_BUILD_DIR}%{_log_dir} +fi + +if [ -d ${RPM_BUILD_DIR}%{_conf_dir} ]; then + rm -rf ${RPM_BUILD_DIR}%{_conf_dir} +fi + +if [ -d ${RPM_BUILD_DIR}%{_pid_dir} ]; then + rm -rf ${RPM_BUILD_DIR}%{_pid_dir} +fi + +mkdir -p ${RPM_BUILD_DIR}%{_conf_dir} +mkdir -p ${RPM_BUILD_DIR}%{_bin_dir} +mkdir -p ${RPM_BUILD_DIR}%{_include_dir} +mkdir -p ${RPM_BUILD_DIR}%{_lib_dir} +mkdir -p ${RPM_BUILD_DIR}%{_libexec_dir} +mkdir -p ${RPM_BUILD_DIR}%{_log_dir} +mkdir -p ${RPM_BUILD_DIR}%{_conf_dir} +mkdir -p ${RPM_BUILD_DIR}%{_man_dir} +mkdir -p ${RPM_BUILD_DIR}%{_pid_dir} +mkdir -p ${RPM_BUILD_DIR}%{_sbin_dir} +mkdir -p ${RPM_BUILD_DIR}%{_share_dir} +mkdir -p ${RPM_BUILD_DIR}%{_src_dir} + +cp ${RPM_BUILD_DIR}/%{_final_name}/src/packages/update-hbase-env.sh ${RPM_BUILD_DIR}/%{_final_name}/sbin/update-hbase-env.sh +cp ${RPM_BUILD_DIR}/%{_final_name}/src/packages/rpm/init.d/hbase-master ${RPM_BUILD_DIR}/%{_final_name}/sbin/hbase-master +cp ${RPM_BUILD_DIR}/%{_final_name}/src/packages/rpm/init.d/hbase-regionserver ${RPM_BUILD_DIR}/%{_final_name}/sbin/hbase-regionserver +chmod 0755 ${RPM_BUILD_DIR}/%{_final_name}/sbin/* +rm -f ${RPM_BUILD_DIR}/%{_final_name}/lib/hadoop-core* +rm -f ${RPM_BUILD_DIR}/%{_final_name}/lib/zookeeper* +mv -f ${RPM_BUILD_DIR}/%{_final_name}/conf/* ${RPM_BUILD_DIR}%{_conf_dir} +mv -f ${RPM_BUILD_DIR}/%{_final_name}/* ${RPM_BUILD_DIR}%{_share_dir} + +rm -rf ${RPM_BUILD_DIR}/%{_final_name} + +%preun +${RPM_INSTALL_PREFIX0}/share/hbase/sbin/update-hbase-env.sh \ + --prefix=${RPM_INSTALL_PREFIX0} \ + --bin-dir=${RPM_INSTALL_PREFIX0}/bin \ + --conf-dir=${RPM_INSTALL_PREFIX1} \ + --log-dir=${RPM_INSTALL_PREFIX2} \ + --pid-dir=${RPM_INSTALL_PREFIX3} \ + --uninstall + +%pre +getent group hadoop 2>/dev/null >/dev/null || /usr/sbin/groupadd -r hadoop + +/usr/sbin/useradd --comment "HBase" --shell /bin/bash -M -r --groups hadoop --home %{_share_dir} hbase 2> /dev/null || : + +%post +${RPM_INSTALL_PREFIX0}/share/hbase/sbin/update-hbase-env.sh \ + --prefix=${RPM_INSTALL_PREFIX0} \ + --bin-dir=${RPM_INSTALL_PREFIX0}/bin \ + --conf-dir=${RPM_INSTALL_PREFIX1} \ + --log-dir=${RPM_INSTALL_PREFIX2} \ + --pid-dir=${RPM_INSTALL_PREFIX3} + +%files +%defattr(-,root,root) +%{_prefix} +%config %{_conf_dir} Index: src/packages/rpm/spec/conf-pseudo.spec =================================================================== --- src/packages/rpm/spec/conf-pseudo.spec (revision 0) +++ src/packages/rpm/spec/conf-pseudo.spec (revision 0) @@ -0,0 +1,103 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# RPM Spec file for HBase version @version@ +# + +%define name hbase-conf-pseudo +%define version @version@ +%define release @package.release@ + +# Installation Locations +%define _source @package.name@ +%define _final_name @final.name@ +%define _prefix @package.prefix@ +%define _bin_dir %{_prefix}/bin +%define _conf_dir @package.conf.dir@ +%define _include_dir %{_prefix}/include +%define _lib_dir %{_prefix}/lib +%define _lib64_dir %{_prefix}/lib64 +%define _libexec_dir %{_prefix}/libexec +%define _log_dir @package.log.dir@ +%define _man_dir %{_prefix}/man +%define _pid_dir @package.pid.dir@ +%define _sbin_dir %{_prefix}/sbin +%define _share_dir %{_prefix}/share/hbase +%define _src_dir %{_prefix}/src +%define _var_dir %{_prefix}/var/lib + +# Build time settings +%define _build_dir @package.build.dir@ +%define _final_name @final.name@ +%define debug_package %{nil} + +Summary: Default HBase configuration templates +License: Apache License, Version 2.0 +URL: http://hbase.apache.org/ +Vendor: Apache Software Foundation +Group: Development/Libraries +Name: %{name} +Version: %{version} +Release: %{release} +Source0: %{_source} +Prefix: %{_prefix} +Prefix: %{_conf_dir} +Prefix: %{_log_dir} +Prefix: %{_pid_dir} +Buildroot: %{_build_dir} +Requires: hbase == %{version}, sh-utils, textutils, /usr/sbin/useradd, /usr/sbin/usermod, /sbin/chkconfig, /sbin/service, jdk >= 1.6 +AutoReqProv: no +Provides: hbase-conf-pseudo + +%description +Installation of this RPM will setup your machine to run in pseudo-distributed mode where each HBase daemon runs in a separate Java process. + +%prep +%setup -n %{_final_name} + +%build +if [ -d ${RPM_BUILD_DIR}%{_conf_dir} ]; then + rm -rf ${RPM_BUILD_DIR}%{_conf_dir} +fi + +mkdir -p ${RPM_BUILD_DIR}%{_conf_dir} +mkdir -p ${RPM_BUILD_DIR}%{_share_dir}/src/packages/conf-pseudo +cp -f ${RPM_BUILD_DIR}/%{_final_name}/src/packages/conf-pseudo/hbase-site.xml ${RPM_BUILD_DIR}%{_share_dir}/src/packages/conf-pseudo/hbase-site.xml +rm -rf ${RPM_BUILD_DIR}/%{_final_name} + +%preun +/sbin/chkconfig --del hbase-master +/sbin/chkconfig --del hbase-regionserver +/etc/init.d/hbase-master stop 2>/dev/null >/dev/null +/etc/init.d/hbase-regionserver stop 2>/dev/null >/dev/null +exit 0 + +%post +cp -f ${RPM_INSTALL_PREFIX0}/share/hbase/src/packages/conf-pseudo/*.xml ${RPM_INSTALL_PREFIX1} 2>/dev/null >/dev/null +/etc/init.d/hadoop-namenode start 2>/dev/null >/dev/null +/etc/init.d/hadoop-datanode start 2>/dev/null >/dev/null +su - hdfs -c "hadoop fs -mkdir /hbase" 2>/dev/null >/dev/null +su - hdfs -c "hadoop fs -chown hbase /hbase" 2>/dev/null >/dev/null +/etc/init.d/hbase-master start 2>/dev/null >/dev/null +/etc/init.d/hbase-regionserver start 2>/dev/null >/dev/null +/sbin/chkconfig hbase-master --add +/sbin/chkconfig hbase-regionserver --add +/sbin/chkconfig hbase-master on +/sbin/chkconfig hbase-regionserver on + +%files +%defattr(-,root,root) +%config %{_share_dir}/src/packages/conf-pseudo/hbase-site.xml Index: pom.xml =================================================================== --- pom.xml (revision 1078100) +++ pom.xml (working copy) @@ -339,6 +339,15 @@ src/assembly/all.xml + + + tarball + package + + single + + + @@ -347,6 +356,7 @@ maven-jar-plugin + prepare-package test-jar @@ -375,7 +385,7 @@ attach-sources - package + prepare-package jar-no-fork @@ -524,6 +534,13 @@ 1.0.1 0.2.0 3.3.2 + /usr + /etc/hbase + /var/log/hbase + /var/run/hbase + 1 + 0.91.0 + ${artifactId}-${version} @@ -827,7 +844,73 @@ $ mvn -s /my/path/settings.xml deploy --> - + + + rpm + + + + maven-antrun-plugin + 1.6 + + + build-rpm + package + + + + + + + + + + run + + + + + + + + + deb + + + + maven-antrun-plugin + 1.6 + + + build-deb + package + + + + + + + + + + + run + + + + + + org.vafer + jdeb + 0.8 + + + + + + + +