《hbase学习》-05-HBase分布式安装

时间:2022-09-22 08:24:10

1.简介

主要介绍HBase的集群安装,以及遇到的问题

2.准备

1.要有自己的集群,本次测试是HA集群
hadoop学习历程–笔记心得8-HA环境搭建试验
http://blog.csdn.net/qq_21383435/article/details/76390346
2.集群正常运行
3.下载hbase-1.2.6-bin.tar.gz

3.配置

1.解压文件

[root@biluos logs]# tar -zxvf /opt/software/hbase-1.2.6-bin.tar.gz -C /opt/moudles/

2.修改环境变量,三台机器都执行

vim /etc/profile

#####--------hbase-------#########
export HBASE_HOME=/opt/moudles/hbase-1.2.6
export PATH=$PATH:$HBASE_HOME/bin

使文件生效
source /etc/profile

3.配置

<configuration>

<!--采用分布式模式-->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>


<!--hbase存储在HADOOP HDFS上文件根目录路径-->
<property>
<name>hbase.rootdir</name>
<value>hdfs://mycluster/hbase</value>
</property>


<!--zookeeper地址,端口不指定的话就默认为2181-->
<property>
<name>hbase.zookeeper.quorum</name>
<value>biluos.com,biluos1.com,biluos2.com</value>
</property>


<!--hbase临时文件存储目录,比如一些数据表的预分区信息等等-->
<property>
<name>hbase.tmp.dir</name>
<value>/opt/moudles/hbase-1.2.6.data/tmp</value>
</property>
<property>
<name>hbase.local.dir</name>
<value>/opt/moudles/hbase-1.2.6.data/local_dir</value>
</property>
<property>
<name>hbase.master</name>
<value>hdfs://biluos.com:60000</value>
</property>

<!--zookeeper存储数据位置-->
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/opt/moudles/hbase-1.2.6.data/hbase_zookeeper_data</value>
</property>

</configuration>

4.拷贝hadoop的配置文件core-site.xml和hdfs-site.xml到$HBASE_HOME/conf目录下

5.启动

[root@biluos bin]# ./start-hbase.sh

6.报错

biluos1.com: starting zookeeper, logging to /opt/moudles/hbase-1.2.6/bin/../logs/hbase-root-zookeeper-biluos1.com.out
biluos.com: starting zookeeper, logging to /opt/moudles/hbase-1.2.6/bin/../logs/hbase-root-zookeeper-biluos.com.out
biluos2.com: starting zookeeper, logging to /opt/moudles/hbase-1.2.6/bin/../logs/hbase-root-zookeeper-biluos2.com.out
starting master, logging to /opt/moudles/hbase-1.2.6/logs/hbase-root-master-biluos.com.out
这一点报错
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
starting regionserver, logging to /opt/moudles/hbase-1.2.6/logs/hbase-root-1-regionserver-biluos.com.out

原因是conf/hbase-env.sh的两个配置搞鬼,注释掉就好了

vim conf/hbase-env.sh

# Configure PermSize. Only needed in JDK7. You can safely remove it for JDK8+
#export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"
#export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"

7.重新启动

主节点三个
26824 HRegionServer
26683 HMaster
24095 QuorumPeerMain

[root@biluos logs]# hostname
biluos.com
[root@biluos logs]# jps
30688 Master
27523 DFSZKFailoverController
19846 Bootstrap
26824 HRegionServer
27209 NameNode
16746 Nailgun
28138 Jps
27344 DataNode
30900 HistoryServer
27062 JournalNode
30585 Worker
26683 HMaster
27323 Main
24095 QuorumPeerMain
[root@biluos logs]#


datanode节点
26740 QuorumPeerMain
27678 HRegionServer

[root@biluos1 conf]# hostname
biluos1.com
You have new mail in /var/spool/mail/root
[root@biluos1 conf]# jps
24420 NameNode
26740 QuorumPeerMain
24726 DFSZKFailoverController
24296 JournalNode
28104 Jps
27291 Worker
27678 HRegionServer
24543 DataNode
[root@biluos1 conf]#


[root@biluos2 zookeeper-3.4.6]# hostname
biluos2.com
You have new mail in /var/spool/mail/root
[root@biluos2 zookeeper-3.4.6]# jps
18833 HRegionServer
13010 JournalNode
18067 QuorumPeerMain
19093 Jps
13096 DataNode
13962 Worker
[root@biluos2 zookeeper-3.4.6]#

jps如上,而且查看日志不报错

8.继续验证
建表测试通过,那么集群搭建就射成功了

[root@biluos hbase-1.2.6]# hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/moudles/hbase-1.2.6/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/moudles/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.6, rUnknown, Mon May 29 02:25:32 CDT 2017

hbase(main):001:0> list
TABLE
0 row(s) in 0.2570 seconds

=> []
hbase(main):002:0> create 'test_lcc_person','lcc_liezu'
0 row(s) in 1.3670 seconds

=> Hbase::Table - test_lcc_person
hbase(main):003:0> list
TABLE
test_lcc_person
1 row(s) in 0.0140 seconds

=> ["test_lcc_person"]
hbase(main):004:0>

9.验证界面可以访问
《hbase学习》-05-HBase分布式安装