群起zookeeperクラスタ、hadoopクラスタ、sparkクラスタ、kylinクラスタ

3830 ワード

kylinの環境を構築した後、解決しなければならない問題はクラスタの群起であり、各ノードに順次コマンドを入力すれば、疲れてしまうと推定される.したがってshellスクリプトを使用してクラスタを起動および停止します.
zookeeperクラスタとhadoopクラスタの起動
#!/bin/bash
echo "================         Zookeeper                    ==========="
echo "================           root@repo             ================"
zkServer.sh start
for node in root@node1 root@node2 root@node3
do
        echo "--------"$node"--------" 
        ssh $node "source /etc/profile;source ~/.bash_profile;/home/hadoop/zk-cluster.sh"
done#   source /etc/profile;source ~/.bash_profile;                     
echo "================         HDFS                    ==========="
start-dfs.sh
echo "================         YARN                    ==========="
ssh root@node2 'start-yarn.sh'
echo "================         JobHistoryServer        ==========="
ssh root@node1 'mr-jobhistory-daemon.sh start historyserver'
echo "================           root@repo             ================"
jps
for i in root@node1 root@node2 root@node3
do
        echo "================           $i             ================"
        ssh $i '/usr/local/jdk1.8.0_201/bin/jps'
done

kylinクラスタの起動:
#!/bin/bash
echo "================         HBase                    ==========="
start-hbase.sh
echo "================         Spark                    ==========="
/home/hadoop/apps/spark-2.2.3/sbin/start-spark-all.sh
echo "================         Kylin                    ==========="
ssh root@node1 'source /etc/profile;source ~/.bash_profile;/home/hadoop/apps/kylin-2.6.1/bin/kylin.sh start'
echo "================               ==========="
echo "================           repo             ================"
jps
for i in root@node1 root@node2 root@node3
do
        echo "================           $i             ================"
        ssh $i '/usr/local/jdk1.8.0_201/bin/jps'
done

 
kylinクラスタを閉じる
#!/bin/bash

echo "================         Kylin                    ==========="
ssh root@node1 'source /etc/profile;source ~/.bash_profile;/home/hadoop/apps/kylin-2.6.1/bin/kylin.sh stop'
echo "================         Spark                    ==========="
/home/hadoop/apps/spark-2.2.3/sbin/stop-spark-all.sh
echo "================         HBase                    ==========="
stop-hbase.sh
echo "================               ==========="
echo "================           repo             ================"
jps
for i in root@node1 root@node2 root@node3
do
        echo "================           $i             ================"
        ssh $i '/usr/local/jdk1.8.0_201/bin/jps'
done

hadoopクラスタを閉じる
#!/bin/bash
echo "================                           ==========="
echo "================         Zookeeper               ==========="
for i in root@node1 root@node2 root@node3
do
        echo "================           $i             ================"
        ssh $i 'zkServer.sh stop'
done
echo "================         HDFS                    ==========="
stop-dfs.sh
echo "================         YARN                    ==========="
ssh root@node2 'stop-yarn.sh'
echo "================         JobHistoryServer        ==========="
ssh root@node1 'mr-jobhistory-daemon.sh stop historyserver'
echo "================           root@repo             ================"
jps
for i in root@node1 root@node2 root@node3
do
        echo "================           $i             ================"
        ssh $i 'jps'
done