打赏

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

posted @ 2019-08-30 15:41  不像话  阅读(915)  评论(0编辑  收藏  举报