1 停止elasticsearch集群
#!/bin/bash
esServers='cdh01 cdh02'
#启动所有的elasticsearch
for es in $esServers
do
ssh -T $es <<EOF
source ~/.bash_profile
ps aux |grep elasticsearch |grep -v grep |awk '{print \$2}' |xargs kill -9
EOF
echo 从节点 $es 停止elasticsearch...[ done ]
sleep 5
done
2 停止hadoop集群
#!/bin/bash
#停止hadoop
standbyNode='cdh02'
source ~/.bash_profile
stop-all.sh
ssh -T $standbyNode <<EOF
source ~/.bash_profile
yarn-daemon.sh stop resourcemanager
EOF
echo $standbyNode 停止resourcemanager...[ done ]
3 停止kafka集群
#!/bin/bash
kafkaServers='cdh01 cdh02 cdh03 cdh04 cdh05'
#停止所有的kafka
for kafka in $kafkaServers
do
ssh -T $kafka <<EOF
source ~/.bash_profile
cd /bigdata/kafka
bin/kafka-server-stop.sh
EOF
echo 从节点 $kafka 停止kafka...[ done ]
sleep 5
done
4 停止zk集群
#!/bin/bash
zkServers='storm01 storm02 storm03'
for zk in $zkServers
do
ssh -T $zk <<EOF
source ~/.bash_profile
zkServer.sh stop
EOF
echo 从节点 $zk 启动zookeeper...[ done ]
sleep 5
done
5 停止kibana
#!/bin/bash
esServers='cdh01'
for es in $esServers
do
ssh -T $es <<EOF
source ~/.bash_profile
ps aux |grep kibana |grep -v grep |awk '{print \$2}' |xargs kill -9
EOF
echo 从节点 $es 停止kibana...[ done ]
sleep 5
done