Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merging ACCUMULO-792 to trunk

git-svn-id: https://svn.apache.org/repos/asf/accumulo/trunk@1423477 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit df2bc950015ce5024ef6259060d54699fb5e5726 1 parent f22f051
John Vines authored
View
9 assemble/platform/debian/gc-only-init.sh → assemble/scripts/gc-only-init.sh
@@ -37,4 +37,11 @@ if ! id -u accumulo >/dev/null 2>&1; then
fi
install -m 0755 -o root -g root init.d/accumulo-gc /etc/init.d/
-update-rc.d accumulo-gc start 21 2 3 4 5 . stop 20 0 1 6 .
+
+if [ -e "`which update-rc.d`" ]; then
+ update-rc.d accumulo-gc start 21 2 3 4 5 . stop 20 0 1 6 .
+elif [ -e "`which chkconfig`" ]; then
+ chkconfig --add accumulo-gc
+else
+ echo "No update-rc.d or chkconfig, rc levels not set for accumulo-gc"
+fi
View
8 assemble/platform/debian/init.d/accumulo-gc → assemble/scripts/init.d/accumulo-gc
@@ -1,4 +1,5 @@
#! /bin/sh
+# chkconfig: 2345 21 20
### BEGIN INIT INFO
# Provides: accumulo-gc
# Required-Start: $network $local_fs
@@ -42,7 +43,12 @@ SCRIPTNAME=/etc/init.d/$NAME
[ -r /etc/default/accumulo ] && . /etc/default/accumulo
# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
+if [ -f /lib/init/vars.sh ]; then
+ . /lib/init/vars.sh
+else
+ log_daemon_msg() { logger "$@"; }
+ log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
+fi
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
View
8 assemble/platform/debian/init.d/accumulo-master → assemble/scripts/init.d/accumulo-master
@@ -1,4 +1,5 @@
#! /bin/sh
+# chkconfig: 2345 21 19
### BEGIN INIT INFO
# Provides: accumulo-master
# Required-Start: $network $local_fs hadoop-namenode zookeeper-server
@@ -42,7 +43,12 @@ SCRIPTNAME=/etc/init.d/$NAME
[ -r /etc/default/accumulo ] && . /etc/default/accumulo
# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
+if [ -f /lib/init/vars.sh ]; then
+ . /lib/init/vars.sh
+else
+ log_daemon_msg() { logger "$@"; }
+ log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
+fi
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
View
8 assemble/platform/debian/init.d/accumulo-monitor → assemble/scripts/init.d/accumulo-monitor
@@ -1,4 +1,5 @@
#! /bin/sh
+# chkconfig: 2345 21 20
### BEGIN INIT INFO
# Provides: accumulo-monitor
# Required-Start: $network $local_fs
@@ -42,7 +43,12 @@ SCRIPTNAME=/etc/init.d/$NAME
[ -r /etc/default/accumulo ] && . /etc/default/accumulo
# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
+if [ -f /lib/init/vars.sh ]; then
+ . /lib/init/vars.sh
+else
+ log_daemon_msg() { logger "$@"; }
+ log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
+fi
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
View
164 assemble/scripts/init.d/accumulo-slave
@@ -0,0 +1,164 @@
+#! /bin/sh
+# chkconfig: 2345 21 15
+### BEGIN INIT INFO
+# Provides: accumulo-slave
+# Required-Start: $network $local_fs hadoop-namenode hadoop-datanode zookeeper-server accumulo-master
+# Required-Stop: $network $local_fs hadoop-datanode hadoop-namenode zookeeper-server accumulo-master
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: accumulo tserver and logger processes
+# Description: The accumulo slaves bundle the tserver and logger processes for accumulo
+### END INIT INFO
+
+# 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.
+
+# Do NOT "set -e"
+install -d -m 0775 -o root -g accumulo /var/run/accumulo
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin
+DESC="Accumulo Slave"
+NAME=accumulo-slave
+ACCUMULO_PROC1=tserver
+ACCUMULO_PROC2=logger
+DAEMON=/usr/lib/accumulo/bin/start-server.sh
+IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1`
+DAEMON_ARGS="$IP slaves"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Read configuration variable file if it is present
+[ -r /etc/default/accumulo ] && . /etc/default/accumulo
+
+# Load the VERBOSE setting and other rcS variables
+if [ -f /lib/init/vars.sh ]; then
+ . /lib/init/vars.sh
+else
+ log_daemon_msg() { logger "$@"; }
+ log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
+fi
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ TARGET_USER_NAME="ACCUMULO_USER"
+ TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+
+ if [ "`jps -m | grep $ACCUMULO_PROC1`" -a "`jps -m | grep $ACCUMULO_PROC2`" ] ; then return 1; fi
+
+ su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/start-server.sh $IP logger"
+ su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/start-server.sh $IP tserver \"tablet server\""
+
+ if [ "`jps -m | grep $ACCUMULO_PROC1`" -a "`jps -m | grep $ACCUMULO_PROC2`" ] ; then return 0; fi
+ return 2
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+
+ if [ ! "`jps -m | grep $ACCUMULO_PROC1`" -a ! "`jps -m | grep $ACCUMULO_PROC2`" ] ; then return 1; fi
+
+ su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/accumulo admin stop $IP"
+
+ if [ "`jps -m | grep $ACCUMULO_PROC1`" ] ; then jps -m | grep $ACCUMULO_PROC1 | awk '{print $1}' | xargs kill -9; fi
+ if [ "`jps -m | grep $ACCUMULO_PROC2`" ] ; then jps -m | grep $ACCUMULO_PROC2 | awk '{print $1}' | xargs kill -9; fi
+
+ if [ "`jps -m | grep $ACCUMULO_PROC1`" -a "`jps -m | grep $ACCUMULO_PROC2`" ] ; then return 2; fi
+
+ return 0;
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ #reload|force-reload)
+ #
+ # If do_reload() is not implemented then leave this commented out
+ # and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
View
8 assemble/platform/debian/init.d/accumulo-tracer → assemble/scripts/init.d/accumulo-tracer
@@ -1,4 +1,5 @@
#! /bin/sh
+# chkconfig: 2345 21 20
### BEGIN INIT INFO
# Provides: accumulo-tracer
# Required-Start: $network $local_fs zookeeper-server
@@ -42,7 +43,12 @@ SCRIPTNAME=/etc/init.d/$NAME
[ -r /etc/default/accumulo ] && . /etc/default/accumulo
# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
+if [ -f /lib/init/vars.sh ]; then
+ . /lib/init/vars.sh
+else
+ log_daemon_msg() { logger "$@"; }
+ log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
+fi
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
View
31 assemble/platform/debian/init.d/accumulo-tserver → assemble/scripts/init.d/accumulo-tserver
@@ -1,12 +1,13 @@
#! /bin/sh
+# chkconfig: 2345 21 15
### BEGIN INIT INFO
-# Provides: accumulo-tserver
-# Required-Start: $network $local_fs hadoop-namenode hadoop-datanode zookeeper-server
-# Required-Stop: $network $local_fs hadoop-datanode hadoop-namenode zookeeper-server
+# Provides: accumulo-slave
+# Required-Start: $network $local_fs hadoop-namenode hadoop-datanode zookeeper-server accumulo-master
+# Required-Stop: $network $local_fs hadoop-datanode hadoop-namenode zookeeper-server accumulo-master
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
-# Short-Description: accumulo tserver process
-# Description: The accumulo tserver process
+# Short-Description: accumulo tserver and logger processes
+# Description: The accumulo slaves bundle the tserver and logger processes for accumulo
### END INIT INFO
# Licensed to the Apache Software Foundation (ASF) under one or more
@@ -29,7 +30,7 @@ install -d -m 0775 -o root -g accumulo /var/run/accumulo
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin
-DESC="Accumulo tserver"
+DESC="Accumulo Tserver"
NAME=accumulo-tserver
ACCUMULO_PROC=tserver
DAEMON=/usr/lib/accumulo/bin/start-server.sh
@@ -42,7 +43,12 @@ SCRIPTNAME=/etc/init.d/$NAME
[ -r /etc/default/accumulo ] && . /etc/default/accumulo
# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
+if [ -f /lib/init/vars.sh ]; then
+ . /lib/init/vars.sh
+else
+ log_daemon_msg() { logger "$@"; }
+ log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
+fi
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
@@ -61,11 +67,11 @@ do_start()
# 1 if daemon was already running
# 2 if daemon could not be started
- if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/start-server.sh $IP tserver \"tablet server\""
- if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi
return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
@@ -83,14 +89,13 @@ do_stop()
# 2 if daemon could not be stopped
# other if a failure occurred
- if [ ! "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
+ if [ ! "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/accumulo admin stop $IP"
- if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then jps -m | grep $ACCUMULO_PROC | awk '{print $1}' | xargs kill -9; fi
-
- if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 2; fi
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then jps -m | grep $ACCUMULO_PROC | awk '{print $1}' | xargs kill -9; fi
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 2; fi
return 0;
}
View
8 assemble/platform/debian/master-only-init.sh → assemble/scripts/master-only-init.sh
@@ -37,4 +37,10 @@ if ! id -u accumulo >/dev/null 2>&1; then
fi
install -m 0755 -o root -g root init.d/accumulo-master /etc/init.d/
-update-rc.d accumulo-master start 21 2 3 4 5 . stop 19 0 1 6 .
+if [ -e "`which update-rc.d`" ]; then
+ update-rc.d accumulo-master start 21 2 3 4 5 . stop 19 0 1 6 .
+elif [ -e "`which chkconfig`" ]; then
+ chkconfig --add accumulo-master
+else
+ echo "No update-rc.d or chkconfig, rc levels not set for accumulo-master"
+fi
View
8 assemble/platform/debian/monitor-only-init.sh → assemble/scripts/monitor-only-init.sh
@@ -36,4 +36,10 @@ if ! id -u accumulo_monitor >/dev/null 2>&1; then
fi
install -m 0755 -o root -g root init.d/accumulo-monitor /etc/init.d/
-update-rc.d accumulo-monitor start 21 2 3 4 5 . stop 20 0 1 6 .
+if [ -e "`which update-rc.d`" ]; then
+ update-rc.d accumulo-monitor start 21 2 3 4 5 . stop 20 0 1 6 .
+elif [ -e "`which chkconfig`" ]; then
+ chkconfig --add accumulo-monitor
+else
+ echo "No update-rc.d or chkconfig, rc levels not set for accumulo-monitor"
+fi
View
46 assemble/scripts/slave-only-init.sh
@@ -0,0 +1,46 @@
+#! /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.
+
+if [ $(id -ur) -ne 0 ]; then
+ echo "This script must be run as root" 1>&2
+ exit 1
+fi
+
+if [ ! -f /etc/default/accumulo ]; then
+ mkdir -p /etc/default
+ touch /etc/default/accumulo
+fi
+
+if ! grep "ACCUMULO_USER=" /etc/default/accumulo >> /dev/null ; then
+ echo "ACCUMULO_USER=accumulo" >> /etc/default/accumulo
+fi
+
+if ! id -u accumulo >/dev/null 2>&1; then
+ groupArg="U"
+ if egrep "^accumulo:" /etc/group >> /dev/null; then
+ groupArg="g accumulo"
+ fi
+ useradd -$groupArg -d /usr/lib/accumulo accumulo
+fi
+
+install -m 0755 -o root -g root init.d/accumulo-slave /etc/init.d/
+if [ -e "`which update-rc.d`" ]; then
+ update-rc.d accumulo-slave start 21 2 3 4 5 . stop 15 0 1 6 .
+elif [ -e "`which chkconfig`" ]; then
+ chkconfig --add accumulo-slave
+else
+ echo "No update-rc.d or chkconfig, rc levels not set for accumulo-slave"
+fi
View
0  assemble/platform/debian/stand-alone-init.sh → assemble/scripts/stand-alone-init.sh
File renamed without changes
View
8 assemble/platform/debian/tracer-only-init.sh → assemble/scripts/tracer-only-init.sh
@@ -36,4 +36,10 @@ if ! id -u accumulo_tracer >/dev/null 2>&1; then
fi
install -m 0755 -o root -g root init.d/accumulo-tracer /etc/init.d/
-update-rc.d accumulo-tracer start 21 2 3 4 5 . stop 20 0 1 6 .
+if [ -e "`which update-rc.d`" ]; then
+ update-rc.d accumulo-tracer start 21 2 3 4 5 . stop 20 0 1 6 .
+elif [ -e "`which chkconfig`" ]; then
+ chkconfig --add accumulo-tracer
+else
+ echo "No update-rc.d or chkconfig, rc levels not set for accumulo-tracer"
+fi
View
9 assemble/platform/debian/tserver-only-init.sh → assemble/scripts/tserver-only-init.sh
@@ -1,5 +1,4 @@
#! /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.
@@ -38,4 +37,10 @@ if ! id -u accumulo >/dev/null 2>&1; then
fi
install -m 0755 -o root -g root init.d/accumulo-tserver /etc/init.d/
-update-rc.d accumulo-tserver start 21 2 3 4 5 . stop 15 0 1 6 .
+if [ -e "`which update-rc.d`" ]; then
+ update-rc.d accumulo-tserver start 21 2 3 4 5 . stop 15 0 1 6 .
+elif [ -e "`which chkconfig`" ]; then
+ chkconfig --add accumulo-tserver
+else
+ echo "No update-rc.d or chkconfig, rc levels not set for accumulo-tserver"
+fi
Please sign in to comment.
Something went wrong with that request. Please try again.