Hbase集群模式搭建


1.官網下載hbase安裝包

這里不做贅述。

2.解壓---直接tar -zxvf xxxx

3.配置hbase集群,要修改3個文件(首先zk集群已經安裝好了)
注意:要把hadoop的hdfs-site.xml和core-site.xml 放到hbase/conf下

3.1修改hbase-env.sh
export JAVA_HOME=/usr/java/jdk1.8
//告訴hbase使用外部的zk
export HBASE_MANAGES_ZK=false

vim hbase-site.xml

<configuration>
<!-- 指定hbase在HDFS上存儲的路徑 -->
<property>
<name>hbase.rootdir</name>
<value>hdfs://ns1/hbase</value>
</property>
<!-- 指定hbase是分布式的 -->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<!-- 指定zk的地址,多個用“,”分割 -->
<property>
<name>hbase.zookeeper.quorum</name>
<value>itcast04:2181,itcast05:2181,itcast06:2181</value>
</property>
</configuration>

vim regionservers

itcast03
itcast04
itcast05
itcast06

3.2拷貝hbase到其他節點

scp -r /itcast/hbase-0.96.2-hadoop2/ itcast02:/itcast/
scp -r /itcast/hbase-0.96.2-hadoop2/ itcast03:/itcast/
scp -r /itcast/hbase-0.96.2-hadoop2/ itcast04:/itcast/
scp -r /itcast/hbase-0.96.2-hadoop2/ itcast05:/itcast/
scp -r /itcast/hbase-0.96.2-hadoop2/ itcast06:/itcast/

4.將配置好的HBase拷貝到每一個節點並同步時間。

5.啟動所有的hbase
分別啟動zk
./zkServer.sh start
啟動hbase集群
start-dfs.sh
啟動hbase,在主節點上運行:
start-hbase.sh
6.通過瀏覽器訪問hbase管理頁面
192.168.1.133:60010
7.為保證集群的可靠性,要啟動多個HMaster
hbase-daemon.sh start master
Hmaster不啟動
hbase-site.xml增加配置

<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>

8.啟動異常:

java.lang.IllegalStateException: The procedure WAL relies on the ability to hsync for proper operation during component failures, but the underlying filesystem does not support doing so. Please check the config value of 'hbase.procedure.store.wal.use.hsync' to set the desired level of robustness and ensure the config value of 'hbase.wal.dir' points to a FileSystem mount that can provide it.

hbase-site.xml增加配置 

<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>

9.idea javaapi 連接本地hbase超時

hbase-site.xml增加配置

<property>
<name>hbase.master.ipc.address</name>
<value>0.0.0.0</value>
</property>
<property>
<name>hbase.regionserver.ipc.address</name>
<value>0.0.0.0</value>
</property>

 10.Hbase集群可能會因為時間不同步出現各種問題,我們要配置linux時間同步

在各個節點安裝ntp服務

yum -y install ntp

在所有節點設置時區,中國所用的時區為

timedatectl set-timezone Asia/Shanghai

在master節點更改ntp.conf文件,設置server為其自身,再新增restrict表示可接受網段

# vim /etc/ntp.conf

 

重啟ntp服務

systemctl restart ntpd

在client節點設置ntp服務器ip

# vim /etc/ntp.conf

 

 每個client節點同步server時間

ntpdate master 或者 ntpdate 192.168.60.10

每個client節點啟動ntpd服務

# systemctl start ntpd

# systemctl enable ntpd

所有節點時間同步

# timedatectl set-ntp yes


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM