mark 下我写的集群启动脚本:
#java `cat conf/druid/broker/jvm.config | xargs` -cp conf/druid/_common:conf/druid/broker:lib/* io.druid.cli.Main server broker
function help(){
echo "参数列表"
echo " 参数1 参数2"
echo " serviceName [-f]"
echo "参数1:serviceName: 启动服务的名字"
echo "serviceName可选项:"
echo "1: broker"
echo "2: coordinator"
echo "3: historical"
echo "4: middleManager"
echo "5: overlord"
echo "参数2:[-f]: 是否前台启动"
echo "-f:前台启动,(不加)默认后台启动"
}
function startService(){
# echo $0
# echo $1
# echo $2
echo $service
if [[ $2 == "-f" ]]; then
echo "前台启动"
java -Xmx256m -Duser.timezone=UTC -Dfile.encoding=UTF-8 -classpath conf/druid/_common:conf/druid/$service:lib/* io.druid.cli.Main server $service
else
echo "后台启动"
nohup java -Xmx256m -Duser.timezone=UTC -Dfile.encoding=UTF-8 -classpath conf/druid/_common:conf/druid/$service:lib/* io.druid.cli.Main server $service &
fi;
}
function tips(){
red=`tput setaf 1`
reset=`tput sgr0`
echo "${red}Not correct arguments${reset}"
echo "please use --help or -h for help"
}
if [[ $1 == "--help" || $1 == "-h" ]]; then
help
exit
fi
service=$1
case $service in
"broker")
;;
"coordinator")
;;
"historical")
;;
"middleManager")
;;
"overlord")
;;
*)
tips
exit
esac
if [[ $2 == "-f" || $2 == "" ]]; then
startService $1 $2;
else
tips
exit
fi