代码拉取完成,页面将自动刷新
同步操作将从 数舟/playground 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#! /bin/bash
# Hive组件管理
function hive()
{
hiveInfo=`egrep "hive" $PLAY_HOME/frames.txt`
hiveNode=`echo $hiveInfo | cut -d " " -f3`
nodes=(${hiveNode//,/ })
case $1 in
"start"){
for i in ${nodes[*]}
do
nohup ssh $i "source /etc/profile && hive --service hiveserver2 & 2>&1 >/dev/null" &
nohup ssh $i "source /etc/profile && hive --service metastore & 2>&1 >/dev/null" &
done
};;
"stop"){
for i in ${nodes[*]}
do
ssh $i "source /etc/profile && jps | grep RunJar | awk '{print \$1}' | xargs kill -9 "
done
};;
esac
}
# Presto组件管理
function presto(){
prestoInfo=`egrep "presto" $PLAY_HOME/frames.txt`
presto=`echo $prestoInfo | cut -d " " -f1`
isInstall=`echo $prestoInfo | cut -d " " -f2`
installNode=`echo $prestoInfo | cut -d " " -f3`
nodes=(${installNode//,/ })
if [[ $isInstall = "true" ]];then
case $1 in
"start"){
for i in ${nodes[*]}
do
ssh $i "source /etc/profile && launcher start" &
done
};;
"stop"){
for i in ${nodes[*]}
do
ssh $i "source /etc/profile && launcher stop" &
done
};;
esac
else
echo "presto未安装,请完成安装后再启动!"
fi
}
# Zeppelin组件管理
function zeppelin(){
zpInfo=`egrep "zeppelin" $PLAY_HOME/frames.txt`
zpNode=`echo $zpInfo | cut -d " " -f3`
nodes=(${zpNode//,/ })
case $1 in
"start"){
for i in ${nodes[*]}
do
ssh $i "source /etc/profile && zeppelin-daemon.sh start" &
done
};;
"stop"){
for i in ${nodes[*]}
do
ssh $i "source /etc/profile && zeppelin-daemon.sh stop" &
done
};;
esac
}
# Kylin组件管理
function kylin(){
klInfo=`egrep "kylin" $PLAY_HOME/frames.txt`
klNode=`echo $klInfo | cut -d " " -f3`
nodes=(${klNode//,/ })
case $1 in
"start"){
for i in ${nodes[*]}
do
ssh $i "source /etc/profile && kylin.sh start" &
done
};;
"stop"){
for i in ${nodes[*]}
do
ssh $i "source /etc/profile && kylin.sh stop" &
done
};;
esac
}
# ES组件管理
function es()
{
esInfo=`egrep "elasticsearch" $PLAY_HOME/frames.txt`
isInstall=`echo $esInfo | cut -d " " -f2`
installNode=`echo $esInfo | cut -d " " -f3`
nodes=(${installNode//,/ })
case $1 in
"start"){
for i in ${nodes[*]}
do
# 使用es用户启动elasticsearch后台执行
echo "正在启动 $i 节点"
ssh $i "su -c \"source /etc/profile && elasticsearch -d\" -s /bin/sh es"
done
};;
"stop"){
for i in ${nodes[*]}
do
ssh $i "source /etc/profile && jps | grep Elasticsearch | awk '{print \$1}' | xargs kill -9 "
done
};;
esac
}
# DS组件管理
function ds()
{
dsInfo=`egrep "dolphinscheduler" $PLAY_HOME/frames.txt`
isInstall=`echo $dsInfo | cut -d " " -f2`
installNode=`echo $dsInfo | cut -d " " -f3`
nodes=(${installNode//,/ })
case $1 in
"start"){
for i in ${nodes[*]}
do
echo "正在启动 $i 节点"
ssh $i "source /etc/profile && bash \$DS_HOME/bin/dolphinscheduler-daemon.sh start standalone-server"
done
};;
"stop"){
for i in ${nodes[*]}
do
ssh $i "source /etc/profile && bash \$DS_HOME/bin/dolphinscheduler-daemon.sh stop standalone-server"
done
};;
esac
}
# Zookeeper组件管理
function zookeeper()
{
#1.在frames.txt中查看是否需要安装zk
zkInfo=`egrep "^zookeeper" $PLAY_HOME/frames.txt`
zk=`echo $zkInfo | cut -d " " -f1`
isInstall=`echo $zkInfo | cut -d " " -f2`
installNode=`echo $zkInfo | cut -d " " -f3`
nodes=(${installNode//,/ })
case $1 in
"start"){
for i in ${nodes[*]}
do
nohup ssh $i "source /etc/profile && zkServer.sh start"
done
};;
"stop"){
for i in ${nodes[*]}
do
ssh $i "source /etc/profile && zkServer.sh stop "
done
};;
esac
}
if [ "$#" -lt 2 ]; then
echo "缺少参数,请输入需要执行的脚本和操作命令。"
echo "示例:./脚本名.sh [脚本] [操作命令]"
echo "eg:pl_manager hive start"
exit 1
fi
# Hive
if [ $1 == "hive" ]; then
case $2 in
start)
echo "执行Hive启动命令..."
hive start
echo "Hive已启动"
;;
stop)
echo "执行Hive停止命令..."
hive stop
echo "Hive已停止"
;;
*)
echo "无效的Hive操作命令。可用命令:start, stop"
;;
esac
fi
# Presto
if [ $1 == "presto" ]; then
case $2 in
start)
echo "执行Presto启动命令..."
presto start
;;
stop)
echo "执行Presto停止命令..."
presto stop
;;
*)
echo "无效的Presto操作命令。可用命令:start, stop"
;;
esac
fi
# Zeppelin
if [ $1 == "zeppelin" ]; then
case $2 in
start)
echo "执行Zeppelin启动命令..."
zeppelin start
;;
stop)
echo "执行Zeppelin停止命令..."
zeppelin stop
;;
*)
echo "无效的Zeppelin操作命令。可用命令:start, stop"
;;
esac
fi
# Kylin
if [ $1 == "kylin" ]; then
case $2 in
start)
echo "执行Kylin启动命令..."
kylin start
;;
stop)
echo "执行Kylin停止命令..."
kylin stop
;;
*)
echo "无效的Kylin操作命令。可用命令:start, stop"
;;
esac
fi
# es
if [ $1 == "es" ]; then
case $2 in
start)
echo "执行ES启动命令..."
es start
;;
stop)
echo "执行ES停止命令..."
es stop
;;
*)
echo "无效的ES操作命令。可用命令:start, stop"
;;
esac
fi
# ds
if [ $1 == "ds" ]; then
case $2 in
start)
echo "执行DS启动命令..."
ds start
;;
stop)
echo "执行DS停止命令..."
ds stop
;;
*)
echo "无效的DS操作命令。可用命令:start, stop"
;;
esac
fi
# zk
if [ $1 == "zookeeper" ]; then
case $2 in
start)
echo "执行ZK启动命令..."
zookeeper start
;;
stop)
echo "执行ZK停止命令..."
zookeeper stop
;;
*)
echo "无效的ZK操作命令。可用命令:start, stop"
;;
esac
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。