HBase安裝配置html
HBase的安裝有三種模式:單機模式、僞分佈式模式、分佈式模式。shell
其中,HBase在單機模式下不使用HSFS,直接將安裝文件解壓,改個hbase.xml文件就能夠運行了;默認狀況下HBAse數據是存儲在根目錄的tmp文件夾下,能夠經過start-hbase.sh和stop-hbase.sh命令啓動和關閉HBase;而僞分佈式和分佈式模式下的HBase須要HDFS系統;下面是按僞分佈式進行安裝配置HBase,配置好了三個集羣:tjt0一、tjt0二、tjt03,hbase安裝在tjt02機器上運行。apache
一、僞分佈式安裝分佈式
HBase下載,官網地址:http://hbase.apache.org/oop
這裏下載的是hbase-1.2.6版本:hbase-1.2.6-bin.tar.gzspa
1.1 使用HBase自帶的zookeeper命令行
HBase使用zookeeper進行管理,HBase自己自帶了一個zookeeper,So僞分佈式安裝能夠直接使用HBase自帶的zookeeper,無需單獨安裝zookeeper。3d
1.2 解壓HBasecode
將HBase hbase-1.2.6版本解壓到/usr/local目錄下:server
[root@tjt02 opt]# tar -zxvf hbase-1.2.6-bin.tar.gz -C /usr/local
將目錄命名爲hbase目錄:
[root@tjt02 opt]# cd /usr/local/
[root@tjt02 local]# mv hbase-1.2.6 hbase
1.3 修改配置文件:
修改配置文件/usr/local/hbase/conf/hbase-en.sh
[root@tjt02 local]# vi /usr/local/hbase/conf/hbase-env.sh
修改內容以下:
export JAVA_HOME=/opt/jdk1.8.0_181 export HBASE_MANAGES_ZK=true
修改配置文件/usr/local/hbase/conf/hbase-site.xml
[root@tjt02 local]# vi /usr/local/hbase/conf/hbase-site.xml
增長以下配置:
<property>
<name>hbase.rootdir</name>
<value>hdfs://tjt01:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>tjt02</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
1.4 PATH路徑到添加
/etc/profile文件增長:export PATH=$PATH:/usr/local/hbase/bin
[root@tjt02 local]# vi /etc/profile
[root@tjt02 local]# source /etc/profile
[root@tjt02 local]#
1.5 啓動HBase
啓動HBase以前記得啓動hdfs,start-hdfs.sh
[root@tjt02 local]# start-hbase.sh tjt02: starting zookeeper, logging to /usr/local/hbase/bin/../logs/hbase-root-zookeeper-tjt02.out starting master, logging to /usr/local/hbase/bin/../logs/hbase-root-master-tjt02.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 /usr/local/hbase/bin/../logs/hbase-root-1-regionserver-tjt02.out [root@tjt02 local]#
使用jps命令查看HBase是否啓動成功:
HRegionServer、HQuorumPeer、HMaster
1.6 驗證HBase
關閉機器tjt02的防火牆:
[root@tjt02 local]# systemctl stop firewalld [root@tjt02 local]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. [root@tjt02 local]#
訪問HBase首頁: http://172.16.114.131:16010/
使用HBase命令行再次驗證:
[root@tjt02 local]# hbase shell SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/hadoop-2.7.6/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>
Now,HBase安裝配置OK!