Hbase的启动依赖于Hadoop和Zookpeer,必须保证先于它们启动才行。在本地调试每次都要重启三个软件非常麻烦。所以写个脚本hbaseStart.sh来解决这个问题
#!/bin/sh #定义等号的两侧不能有空格 hbaseStart=false while [ true ] do QuoPM=`jps | grep "QuorumPeerMain"` NameNode=`jps | grep "NameNode"` DataNode=`jps | grep "DataNode"` #if的[ ]判断两边均需要有个空格 if [ -n "$NameNode" ] && [ -n "$DataNode" ] && [ -n "$QuoPM" ] && [ "$hbaseStart" = false ] then echo "hadoop和zookper启动完毕开始启动hbase..." hbaseStart=true sh /opt/modules/cdh/hbase-0.98.6-cdh5.3.6/bin/start-hbase.sh elif [ "$hbaseStart" = true ] then echo "结束hbase启动的探测..." break fi sleep 0.5 done
vi /etc/rc.local
su - hadoop -c '/usr/local/zookeeper-3.4.6/bin/zkServer.sh start' su - hadoop -c '/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/start-dfs.sh' su - hadoop -c '/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/start-yarn.sh' /usr/local/shell/hbaseStart.sh
参考链接
https://blog.csdn.net/hexinli/article/details/53040257
https://blog.csdn.net/henni_719/article/details/53674024
https://blog.csdn.net/SunXiWang/article/details/78637746