Flink集群启动脚本(start-flin__k-cluster

  1. cd /usr/local/bin
  2. sudo vi start-flink-cluster

脚本内容如下:

  1. #!/bin/bash
  2. FLINK_HOME=/home/vagrant/modules/flink-1.10.0
  3. echo "start Flink-cluster-------------------------------------------------"
  4. for i in bigdata-node1
  5. do
  6. ssh $i "source /etc/profile;${FLINK_HOME}/bin/start-cluster.sh"
  7. done
  8. sleep 10s
  9. echo "start done..."
  10. echo "cluster jps status------------------------------------------------"
  11. jpsx
  12. exit 0

设置脚本执行权限:

  1. sudo chmod +x start-flink-cluster
  2. sudo chown vagrant:vagrant start-flink-cluster

Flink集群停止脚本(stop-flink-cluster)

  1. cd /usr/local/bin
  2. sudo vi stop-flink-cluster

脚本内容如下:

  1. #!/bin/bash
  2. FLINK_HOME=/home/vagrant/modules/flink-1.10.0
  3. echo "stop Flink-cluster-------------------------------------------------"
  4. for i in bigdata-node1
  5. do
  6. ssh $i "source /etc/profile;${FLINK_HOME}/bin/stop-cluster.sh"
  7. done
  8. sleep 10s
  9. echo "stop done..."
  10. echo "cluster jps status------------------------------------------------"
  11. jpsx
  12. exit 0

设置脚本执行权限:

  1. sudo chmod +x stop-flink-cluster
  2. sudo chown vagrant:vagrant stop-flink-cluster

分发(选做):

  1. # 使用root账户分发至其他节点
  2. sudo scp -r /usr/local/bin/*-flink-cluster root@bigdata-node2:/usr/local/bin/
  3. sudo scp -r /usr/local/bin/*-flink-cluster root@bigdata-node3:/usr/local/bin/