用户/bin下面创建
集群同步执行命令
for i in master slave1 slave2
do
echo --------- $i ----------
ssh $i "$*"
done
hadoop启动/关闭
根据部署来,我的dfs在master上,yarn在salve2上
#!/bin/bash
case $1 in
"start"){
ssh master start-dfs.sh
ssh slave2 start-yarn.sh
};;
"stop"){
ssh master stop-dfs.sh
ssh slave2 stop-yarn.sh
};;
esac
hive启动/关闭
#!/bin/bash
case $1 in
"start"){
nohup hive --service metastore>/dev/null 2>&1 &
nohup hive --service hiveserver2>/dev/null 2>&1 &
};;
"stop"){
jps -ml | grep hive | awk '{print $1}' | xargs kill
};;
esac
Zookeeper启动/关闭/查看
#! /bin/bash
case $1 in
"start"){
for i in master slave1 slave2
do
echo --------- $i ----------
ssh $i "zkServer.sh start"
done
};;
"stop"){
for i in master slave1 slave2
do
echo --------- $i ----------
ssh $i "zkServer.sh stop"
done
};;
"status"){
for i in master slave1 slave2
do
echo --------- $i ----------
ssh $i "zkServer.sh status"
done
};;
esac
Kafka启动/关闭
#!/bin/bash
case $1 in
"start"){
for i in master slave1 slave2
do
echo "-------------启动$i Kafka----------------"
ssh $i "kafka-server-start.sh -daemon /o/software/kafka/config/server.properties"
done
};;
"stop"){
for i in master slave1 slave2
do
echo "-------------停止$i Kafka----------------"
ssh $i "kafka-server-stop.sh"
done
};;
esac
|