在/usr/local/bin 目录下
#!/bin/bash
user=`whoami`
echo "=============== 开始启动所有节点服务 ==============="
echo "=============== 正在启动Zookeeper...... ==============="
for((host=3; host<=5; host++)); do
echo "--------------- node$host Zookeeper...... ----------------"
ssh $user@node$host '/bigdata/zookeeper/bin/zkServer.sh start'
done
echo "================ 正在启动HDFS ==============="
ssh $user@node1 '/bigdata/hadoop/sbin/start-dfs.sh'
echo "================ 正在启动YARN ==============="
ssh $user@node1 '/bigdata/hadoop/sbin/start-yarn.sh'
echo "================ node2正在启动JobHistoryServer ==============="
ssh $user@node2 '/bigdata/hadoop/sbin/mr-jobhistory-daemon.sh start historyserver'
echo "================ 正在启动HBase ==============="
ssh $user@node2 '/bigdata/hbase/bin/start-hbase.sh'
echo "=============== 正在启动Elasticsearch...... ==============="
for((host=1; host<=5; host++)); do
echo "--------------- node$host Elasticsearch...... ----------------"
ssh es@node$host '/bigdata/elasticsearch/bin/elasticsearch -d -p /bigdata/pid/es/pid'
done