1、Hbase搭建准备
集群时间同步
yum install ntp -y
ntpdate -u time.windows.com
1、Hadoop 集群的正常部署并启动
start-all.sh
2、Zookeeper 集群的正常部署并启动
zkServer.sh start
zkServer.sh status

2、搭建hbase
2.1上传解压
tar -xvf hbase-1.4.6-bin.tar.gz
2.2配置环境变量
vim /etc/profile
export HBASE_HOME=/usr/local/soft/hbase-1.4.6
export PATH=$PATH:$HBASE_HOME/bin

source /etc/profile
2.3、修改hbase-env.sh文件
cd /usr/local/soft/hbase-1.4.6/conf
vim hbase-env.sh
1、增加java配置
export JAVA_HOME=/usr/local/soft/jdk1.8.0_171
2、关闭默认zk配置
export HBASE_MANAGES_ZK=false

1、/JAVA_HOME 查找位置并修改  
2、/ZK 查找变量位置并修改 
2.4、修改hbase-site.xml文件
<property>
<name>hbase.rootdir</name>
<value>hdfs://hadoop100:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>hadoop100,hadoop101,hadoop102</value>
</property>

2.5、修改regionservers文件
增加以下节点
hadoop101
hadoop102
如果是伪分布式版本,增加hadoop100即可

2.6、同步到所有节点(如果是伪分布式不需要同步)
scp -r hbase-1.4.6/ hadoop101:`pwd`
scp -r hbase-1.4.6/ hadoop102:`pwd`
 
2.7、同步环境变量(不需再单个配置)
同步环境变量
scp /etc/profile hadoop101:/etc/
scp /etc/profile hadoop102:/etc/
source /etc/profile

2.8、启动hbase集群 , 需要在hadoop100(主节点)上执行
start-hbase.sh
验证hbase:
http://hadoop100:16010
hadoop100节点  hadoop101节点 
hbase日志文件所在的目录
/usr/local/soft/hbase-1.4.6/logs
2.9、关闭hbase集群
stop-hbase.sh
通过 hbase shell 进入到hbase的命令行 
3、hbase 搭建失败 重置hbase
3.1、关闭hbase集群
杀死进程
kill -9 pid(进程编号)
stop-hbase.sh
3.2、删除hdfs数据
hdfs dfs -rmr /hbase
3.3、删除元数据 zk
zkCli.sh
rmr /hbase
3.4、重新启动hbase
start-hbase.sh
|