Bootstrap

一键启动zookeeper、hadoop,spark集群

export PATH=$PATH:$ZOOKEEPER_HOME/bin
# 启动zk集群
echo "启动zk集群..."
cd ${ZOOKEEPER_HOME}
cat /export/onekey/slave | while read line
do
{
 echo $line
 ssh $line "source /etc/profile;export ZOOKEEPER_HOME=/export/server/zookeeper;nohup ${ZOOKEEPER_HOME}/bin/zkServer.sh start"
}&
wait
done

# 启动HDFS集群
echo "启动Hadoop集群..."
/export/server/hadoop/sbin/start-all.sh

# 启动Hive MetaStore 服务器
#!/bin/bash
# 启动hive的metastore服务
hive --service metastore > /dev/null 2>&1 &
echo -n "Starting metastore servece,please wait"
mt=1
while [ $mt -ne 0 ]
  do
    sleep 0.5
    echo -n "."
    netstat -nltp | grep 9083 > /dev/null 2>&1 #端口号根据服务上hive的实际配置的端口号而定
    mt=$?
done
echo ""
echo -e "\e[32mHiveMetastore service is running!\e[0m"
# 启hiveserver2服务
hiveserver2 > /dev/null 2>&1 &
echo -n "Starting hiveserver2 service,please wait"
hv2=1
while [ $hv2 -ne 0 ]
  do
    sleep 0.5
    echo -n "."
    netstat -nltp | grep 10000 > /dev/null 2>&1 #端口号根据服务上hive的实际配置的端口号而定
    hv2=$?
done
echo ""
echo -e "\e[32mHiveServer2 service is running!\e[0m"


# 启动Spark集群
echo "启动Spark集群..."
/export/server/spark/sbin/start-all.sh
/export/server/spark/sbin/start-history-server.sh
sleep 10

# 启动hbase集群
echo "启动hbase集群..."
/export/server/hbase/bin/start-hbase.sh

sleep 10

;