黑猴子的家:es.sh
2021-10-19 本文已影响0人
黑猴子的家
#!/bin/bash
user=`whoami`
elasticsearch_home=/opt/module/elasticsearch-7.10.2
echo -e "================ 正在 $1 ElasticSearch ==========="
case $1 in
start)
for((host=102; host<=104; host++)); do
echo -e "\n--- $1 $user@hadoop$host---"
ssh $user@hadoop$host "nohup $elasticsearch_home/bin/elasticsearch -d -p $elasticsearch_home/es.pid > /dev/null 2>&1"
done
;;
stop)
for((host=102; host<=104; host++)); do
echo -e "\n--- $1 $user@hadoop$host---"
ssh $user@hadoop$host 'kill `cat /opt/module/elasticsearch-7.10.2/es.pid`'
done
;;
*)
echo "你启动的姿势不对"
echo " start 启动elasticsearch集群"
echo " stop 停止elasticsearch集群"
;;
esac