1.环境准备
jdk1.7.0_79
Hadoop2.7.2.(匹配Hbase1.2.2)
zookeeer3.4.8
hbase-1.2.2-bin.tar.gz
最好和hadoop安装在统一用户下,解压安装包
tar zxvf hbase-1.2.2-bin.tar.gz
2. 修改配置文件
- .bashrc(多节点)
export JAVA_HOME=/usr/local/jdk1.7.0_79
export HADOOP_HOME=/home/hadoop/hadoop
export HBASE_HOME=/home/hadoop/hbase
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HBASE_HOME/bin
source .bashrc使其生效
- hbase-env.sh
文件开头添加
export JAVA_HOME=/usr/local/jdk1.7.0_79
#是否使用默认zookeeper
export HBASE_MANAGES_ZK=false
- hbase-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://192.168.163.101:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>192.168.163.101</value>
</property>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
</configuration>
- regionservers
192.168.163.101
192.168.163.102
192.168.163.103
修改完成后将hbase目录发送至各个几点.
3.启动/测试
- 启动
start-hbase.sh
正常启动出现进程
HMaster(主)
HRegionServer(从)
- 测试
#进入命令行
hbase shell
#创建表
create ‘users‘,‘user_id‘,‘address‘,‘info‘
#列出所有表
list
#退出
exit
- 启动时遇到的问题
2018-05-16 21:10:46,599 FATAL [regionserver/centos7-3/192.168.163.103:16020] regionserver.HRegionServer: Master rejected startup because clock is out of sync
org.apache.hadoop.hbase.ClockOutOfSyncException: org.apache.hadoop.hbase.ClockOutOfSyncException: Server centos7-3,16020,1526476234500 has been rejected; Reported t
ime is too far out of sync with master. Time difference of 37645ms > max allowed of 30000ms
at org.apache.hadoop.hbase.master.ServerManager.checkClockSkew(ServerManager.java:407)
at
可以看出从节点与主节点的最大时间差允许30s,而有一个节点出现了37s的时间差.
启动ntp时间同步服务即可.
Hbase1.2.2安装和集群搭建
原文地址:https://www.cnblogs.com/guan-li/p/9916958.html
时间: 2024-10-10 01:18:48