elasticSearch 集群通过脚本进行启停
#!/bin/bash echo "start-----------" hosts=("hadoop01" "hadoop02" "hadoop03") for host in ${hosts[@]} do ssh hadoop@$host << EOF cd ~/app/elasticsearch/bin ./elasticsearch -d -p ./pid exit EOF done for host in ${hosts[@]} do ssh hadoop@$host << EOF jps exit EOF done echo "end-----------------"
以下是关闭集群的脚本
#!/bin/bash echo "start-----------" hosts=("hadoop01" "hadoop02" "hadoop03") for host in ${hosts[@]} do ssh hadoop@$host << EOF jps exit EOF done for host in ${hosts[@]} do ssh hadoop@$host << "EOF" pid=`jps | grep "Elasticsearch" | gawk '{ print $1 }'` if [[ ${pid} && -n ${pid} ]]; then kill -9 ${pid}; fi exit EOF done for host in ${hosts[@]} do ssh hadoop@$host << EOF jps exit EOF done echo "end-----------------"
posted on 2020-10-16 15:11 luzhouxiaoshuai 阅读(458) 评论(0) 编辑 收藏 举报