Adds init scripts (#2939)

This commit is contained in:
Walton Seymour 2016-05-10 12:00:13 -04:00 committed by Fangjin Yang
parent 45b2e65d75
commit 13a2b265a5
7 changed files with 108 additions and 0 deletions

10
examples/bin/broker.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash -eu
usage="Usage: broker.sh (start|stop)"
if [ $# -lt 1 ]; then
echo $usage
exit 1
fi
sh ./bin/node.sh broker $1

View File

@ -0,0 +1,10 @@
#!/bin/bash -eu
usage="Usage: coordinator.sh (start|stop)"
if [ $# -lt 1 ]; then
echo $usage
exit 1
fi
sh ./bin/node.sh coordinator $1

View File

@ -0,0 +1,10 @@
#!/bin/bash -eu
usage="Usage: historical.sh (start|stop)"
if [ $# -lt 1 ]; then
echo $usage
exit 1
fi
sh ./bin/node.sh historical $1

View File

@ -4,9 +4,11 @@ gzip -c -d quickstart/wikiticker-2015-09-12-sampled.json.gz > "quickstart/wikiti
LOG_DIR=var LOG_DIR=var
mkdir log
mkdir -p $LOG_DIR/tmp; mkdir -p $LOG_DIR/tmp;
mkdir -p $LOG_DIR/druid/indexing-logs; mkdir -p $LOG_DIR/druid/indexing-logs;
mkdir -p $LOG_DIR/druid/segments; mkdir -p $LOG_DIR/druid/segments;
mkdir -p $LOG_DIR/druid/segment-cache; mkdir -p $LOG_DIR/druid/segment-cache;
mkdir -p $LOG_DIR/druid/task; mkdir -p $LOG_DIR/druid/task;
mkdir -p $LOG_DIR/druid/hadoop-tmp; mkdir -p $LOG_DIR/druid/hadoop-tmp;
mkdir -p $LOG_DIR/druid/pids;

View File

@ -0,0 +1,10 @@
#!/bin/bash -eu
usage="Usage: middleManager.sh (start|stop)"
if [ $# -lt 1 ]; then
echo $usage
exit 1
fi
sh ./bin/node.sh middleManager $1

56
examples/bin/node.sh Normal file
View File

@ -0,0 +1,56 @@
#!/bin/bash -eu
## Initializtion script for druid nodes
## Runs druid nodes as a daemon and pipes logs to log/ directory
usage="Usage: node.sh nodeType (start|stop)"
if [ $# -le 1 ]; then
echo $usage
exit 1
fi
nodeType=$1
shift
startStop=$1
pid=var/druid/pids/$nodeType.pid
case $startStop in
(start)
if [ -f $pid ]; then
if kill -0 `cat $pid` > /dev/null 2>&1; then
echo $nodeType node running as process `cat $pid`. Stop it first.
exit 1
fi
fi
nohup java `cat conf/druid/$nodeType/jvm.config | xargs` -cp conf/druid/_common:conf/druid/$nodeType:lib/* io.druid.cli.Main server $nodeType > log/$nodeType.log &
nodeType_PID=$!
echo $nodeType_PID > $pid
echo "Started $nodeType node ($nodeType_PID)"
;;
(stop)
if [ -f $pid ]; then
TARGET_PID=`cat $pid`
if kill -0 $TARGET_PID > /dev/null 2>&1; then
echo Stopping process `cat $pid`...
kill $TARGET_PID
else
echo No $nodeType node to stop
fi
rm -f $pid
else
echo No $nodeType node to stop
fi
;;
(*)
echo $usage
exit 1
;;
esac

10
examples/bin/overlord.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash -eu
usage="Usage: overlord.sh (start|stop)"
if [ $# -lt 1 ]; then
echo $usage
exit 1
fi
sh ./bin/node.sh overlord $1