Flink集群启动脚本(start-flin__k-cluster)
cd /usr/local/bin
sudo vi start-flink-cluster
脚本内容如下:
#!/bin/bash
FLINK_HOME=/home/vagrant/modules/flink-1.10.0
echo "start Flink-cluster-------------------------------------------------"
for i in bigdata-node1
do
ssh $i "source /etc/profile;${FLINK_HOME}/bin/start-cluster.sh"
done
sleep 10s
echo "start done..."
echo "cluster jps status------------------------------------------------"
jpsx
exit 0
设置脚本执行权限:
sudo chmod +x start-flink-cluster
sudo chown vagrant:vagrant start-flink-cluster
Flink集群停止脚本(stop-flink-cluster)
cd /usr/local/bin
sudo vi stop-flink-cluster
脚本内容如下:
#!/bin/bash
FLINK_HOME=/home/vagrant/modules/flink-1.10.0
echo "stop Flink-cluster-------------------------------------------------"
for i in bigdata-node1
do
ssh $i "source /etc/profile;${FLINK_HOME}/bin/stop-cluster.sh"
done
sleep 10s
echo "stop done..."
echo "cluster jps status------------------------------------------------"
jpsx
exit 0
设置脚本执行权限:
sudo chmod +x stop-flink-cluster
sudo chown vagrant:vagrant stop-flink-cluster
分发(选做):
# 使用root账户分发至其他节点
sudo scp -r /usr/local/bin/*-flink-cluster root@bigdata-node2:/usr/local/bin/
sudo scp -r /usr/local/bin/*-flink-cluster root@bigdata-node3:/usr/local/bin/