环境:hadoop2.6.1,zk3.4.6
1.配置环境变量
sudo vi /etc/profile.d/hbase-env.sh
export HBASE_HOME=/usr/local/hbase-1.1.2
export PATH=$PATH:/usr/local/hbase-1.1.2/bin
source /etc/profile.d/hbase-env.sh
2.修改配置文件
mkdir /usr/local/hbase-1.1.2/pid
vi hbase-env.sh
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_66
export HBASE_PID_DIR=/usr/local/hbase-1.1.2/pid
export HBASE_MANAGES_ZK=false
false代表zk不交给hbase管理,需要手动启动
vi conf/hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave1,slave2</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/zookeeper-3.4.6/data</value>
</property>
<property>
<name>hbase.master</name>
<value>master</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
</configuration>
vi conf/regionservers
master
slave1
slave2
slave3
修改hbase-env.sh(可以不改)
export HBASE_REGIONSERVER_OPTS="-Xmx4g -Xms4g -Xmn1800m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=70 -verbose:gc -XX:+PrintGCDetails -XX:
+PrintGCTimeStamps -Xloggc:$HBASE_HOME/logs/gc-$(hostname)-hbase.log"
4.替换
在hadoop/share/hadoop/下的jar替换到hbase/lib下
hadoop-annotations-2.6.0.jar
hadoop-auth-2.6.0.jar
hadoop-client-2.6.0.jar
hadoop-common-2.6.0.jar
hadoop-hdfs-2.6.0.jar
hadoop-mapreduce-client-app-2.6.0.jar
hadoop-mapreduce-client-common-2.6.0.jar
hadoop-mapreduce-client-core-2.6.0.jar
hadoop-mapreduce-client-jobclient-2.6.0.jar
hadoop-mapreduce-client-shuffle-2.6.0.jar
hadoop-yarn-api-2.6.0.jar
hadoop-yarn-client-2.6.0.jar
hadoop-yarn-common-2.6.0.jar
hadoop-yarn-server-common-2.6.0.jar
htrace-core-3.0.4.jar
一个15个
5.启动:
start-hbase.sh
4.查看
user0@master:/tmp$ hbase shell
hbase(main):001:0> status
4 servers, 0 dead, 0.5000 average load
网页地址:
master:16010
master:16030
错误:
hbase shell中报
ERROR: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing
日志中:
hbase java.lang.ClassNotFoundException: org.htrace.Trace
没有将htrace-core-3.0.4.jar拷贝到hbase/lib中