大数据软件安装之HBase(NoSQL数据库)

一、安装部署

1、Zookeeper正常部署

(见前篇博文大数据软件安装之ZooKeeper监控 )

[test@hadoop102 zookeeper-3.4.10]$ bin/zkServer.sh start

[test@hadoop103 zookeeper-3.4.10]$ bin/zkServer.sh start

[test@hadoop104 zookeeper-3.4.10]$ bin/zkServer.sh start

2、Hadoop正常部署

(见前篇博文大数据软件安装之Hadoop(Apache)(数据存储及计算 ))

[test@hadoop102 hadoop-2.7.2]$ sbin/start-dfs.sh

[test@hadoop103 hadoop-2.7.2]$ sbin/start-yarn.sh

3、HBase的解压

解压Hbase到指定目录:

[test@hadoop102 software]$ tar -zxvf hbase-1.3.1-bin.tar.gz -C /opt/module

4、HBase的配置文件

修改HBase对应的配置文件。

1)hbase-env.sh修改内容:

export JAVA_HOME=/opt/module/jdk1.8.0_144

export HBASE_MANAGES_ZK=false

2)hbase-site.xml修改内容:

<configuration>

   <property>

      <name>hbase.rootdir</name>

      <value>hdfs://hadoop102:9000/HBase</value>

   </property>

 

   <property>

      <name>hbase.cluster.distributed</name>

      <value>true</value>

   </property>

 

   <!-- 0.98后的新变动,之前版本没有.port,默认端口为60000 -->

   <property>

      <name>hbase.master.port</name>

      <value>16000</value>

   </property>

 

   <property>  

      <name>hbase.zookeeper.quorum</name>

       <value>hadoop102,hadoop103,hadoop104</value>

   </property>

 

   <property>  

      <name>hbase.zookeeper.property.dataDir</name>

       <value>/opt/module/zookeeper-3.4.10/zkData</value>

   </property>

</configuration>

3)regionservers:

hadoop102

hadoop103

hadoop104

4)软连接hadoop配置文件到HBase:

[test@hadoop102 module]$ ln -s /opt/module/hadoop-2.7.2/etc/hadoop/core-site.xml /opt/module/hbase/conf/core-site.xml

[test@hadoop102 module]$ ln -s /opt/module/hadoop-2.7.2/etc/hadoop/hdfs-site.xml /opt/module/hbase/conf/hdfs-site.xml

5、HBase远程发送到其他集群

[test@hadoop102 module]$ xsync hbase/

6 、HBase服务的启动

1).启动方式

 [test@hadoop102 hbase]$ bin/hbase-daemon.sh start master

[test@hadoop102 hbase]$ bin/hbase-daemon.sh start regionserver

提示:如果集群之间的节点时间不同步,会导致regionserver无法启动,抛出ClockOutOfSyncException异常。

修复提示:

a、同步时间服务

时间同步的方式:找一个机器,作为时间服务器,所有的机器与这台集群时间进行定时的同步,比如,每隔十分钟,同步一次时间。

配置时间同步具体实操:

1>.    时间服务器配置(必须root用户)

(1)检查ntp是否安装

[root@hadoop102 桌面]# rpm -qa|grep ntp

ntp-4.2.6p5-10.el6.centos.x86_64

fontpackages-filesystem-1.41-1.1.el6.noarch

ntpdate-4.2.6p5-10.el6.centos.x86_64

(2)修改ntp配置文件

[root@hadoop102 桌面]# vi /etc/ntp.conf

修改内容如下

a)修改1(授权192.168.1.0-192.168.1.255网段上的所有机器可以从这台机器上查询和同步时间)

#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap为

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

              b)修改2(集群在局域网中,不使用其他互联网上的时间)

server 0.centos.pool.ntp.org iburst

server 1.centos.pool.ntp.org iburst

server 2.centos.pool.ntp.org iburst

server 3.centos.pool.ntp.org iburst为

#server 0.centos.pool.ntp.org iburst

#server 1.centos.pool.ntp.org iburst

#server 2.centos.pool.ntp.org iburst

#server 3.centos.pool.ntp.org iburst

c)添加3(当该节点丢失网络连接,依然可以采用本地时间作为时间服务器为集群中的其他节点提供时间同步)

server 127.127.1.0

fudge 127.127.1.0 stratum 10

(3)修改/etc/sysconfig/ntpd 文件

[root@hadoop102 桌面]# vim /etc/sysconfig/ntpd

增加内容如下(让硬件时间与系统时间一起同步)

SYNC_HWCLOCK=yes

         Tips:

         系统时间: 一般说来就是我们执行 date命令看到的时间,linux系统下所有的时间调用(除了直接访问硬件时间的命令)都是使用的这个时间。

        硬件时间: 主板上BIOS中的时间,由主板电池供电来维持运行,系统开机时要读取这时间,并根据它来设定系统时间(注意:系统启动时根据硬件时间设定系统时间的过程可能存在时区换算,这要视具体的系统及相关设置而定)

(4)重新启动ntpd服务

[root@hadoop102 桌面]# service ntpd status

ntpd 已停

[root@hadoop102 桌面]# service ntpd start

正在启动 ntpd:                                            [确定]

(5)设置ntpd服务开机启动

[root@hadoop102 桌面]# chkconfig ntpd on

2>.    其他机器配置(必须root用户)

(1)在其他机器配置10分钟与时间服务器同步一次

[root@hadoop103桌面]# crontab -e

编写定时任务如下:

*/10 * * * * /usr/sbin/ntpdate hadoop102

(2)修改任意机器时间

[root@hadoop103桌面]# date -s "2017-9-11 11:11:11"

(3)十分钟后查看机器是否与时间服务器同步

[root@hadoop103桌面]# date

说明:测试的时候可以将10分钟调整为1分钟,节省时间。

b、属性:hbase.master.maxclockskew设置更大的值(不建议)

<property>

        <name>hbase.master.maxclockskew</name>

        <value>180000</value>

        <description>Time difference of regionserver from master</description>

</property>

2.启动方式2

[test@hadoop102 hbase]$ bin/start-hbase.sh

对应的停止服务:

[test@hadoop102 hbase]$ bin/stop-hbase.sh

7、查看HBase页面

启动成功后,可以通过“host:port”的方式来访问HBase管理页面,例如:

http://hadoop102:16010

原文地址:https://www.cnblogs.com/solomongold/p/12535303.html