[HD] Hadoop开源环境搭建(集群模式):3.HBase/zookeeper

常用的华为FusionInsight C60U10中各组件的版本,以此作为兼容参考:

HDFS:2.7.2
Hive:1.3.0
HBase:1.0.2
Spark:1.5.1
Solr:5.3.1
Flume:1.6.0
Kafka:2.10-0.10.0.0
Storm:0.10.0
Hue:3.9.0
Redis:3.0.5

本文配置:Redhat6.5、JDK-jdk1.7.0_79 、Hadoop-hadoop-2.7.3、zookeeper-3.4.8、hbase-1.2.4-bin

三节点配置和名称(主 8C30G、子6C20G):

192.168.111.140	HMASTER  namenode,datanode(nodeagent) zookeeper HMaster  regionserver
192.168.111.141	HDATA01  datanode(nodeagent) zookeeper regionserver 
192.168.111.142 HDATA02 datanode(nodeagent)zookeeper regionserver
流程概览:安装zookeeper==>安装HBase

详细步骤如下

一、安装zookeeper
1.下载zookeeper版本包到/home/hadoop/BigData/.http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz (所有机器,)

$ cd /home/hadoop/BigData/
$ tar xvf zookeeper-3.4.8.tar.gz

 

2.创建zoo.cfg文件,以HMaster为例:

$ cp /home/hadoop/BigData/zookeeper-3.4.8/conf/zoo_sample.cfg /home/hadoop/BigData/zookeeper-3.4.8/conf/zoo.cfg
$ vi zoo.cfg如下:

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/home/hadoop/BigData/zookeeper-3.4.8/zookeeper-data
# the port at which the clients will connect
clientPort=2181
server.1=HMaster:2888:3888
server.2=HData01:2888:3888
server.3=Hdata02:2888:3888

 

3.然后创建zookeeper-data目录 (3台机器都创建)mkdir /home/hadoop/BigData/zookeeper-3.4.8/zookeeper-data

 

4.创建myid文件(3台机器都创建),以HMaster为例写入对应的server.value

$ echo 1 > /home/hadoop/BigData/zookeeper-3.4.8/zookeeper-data/myid

 

5.启动zookeeper(所有机器)


$ sh home/hadoop/BigData/zookeeper-3.4.8/bin/zkServer.sh start

 

二、安装HBase
1.下载hbase。 下载地址http://mirrors.hust.edu.cn/apache/hbase/1.2.4/hbase-1.2.4-bin.tar.gz


$ cd /home/hadoop/BigData/
$ tar zxvf hbase-1.2.4-bin.tar.gz

 

2.更改hbase-env.sh配置

$ vi /home/hadoop/BigData/hbase-1.2.4/conf/hbase-env.sh
export JAVA_HOME=/usr/local/jdk1.7.0_79
export HBASE_MANAGES_ZK=false

 

3.更改hbase-site.xml文件

<configuration>
    <property>
        <name>hbase.rootdir</name>
        <value>hdfs://192.168.111.140:9000/hbase</value>
    </property>
    <property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>192.168.111.140,192.168.111.141,192.168.111.142</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.clientPort</name>
        <value>2181</value>
    </property>
<property>
     <name>hbase.zookeeper.property.dataDir</name>
     <value>/home/hadoop/BigData/zookeeper-3.5.1-alpha/zookeeper-data</value>
</property>
</configuration>

4.修改regionservers文件,添加regionserver节点


HMASTER
HDATA01
HDATA02

 

5.启动hadoop==>zookeeper,然后启动hbase

$ sh start-hbase.sh

 

6.测试

hbase(main):001:0> create 'students','s_id','info'
0 row(s) in 3.8890 seconds

=> Hbase::Table - students
hbase(main):002:0> put 'students','001','info:name','zacks'
0 row(s) in 0.9490 seconds

hbase(main):003:0> put 'students','001','info:age','25'
0 row(s) in 0.0480 seconds

hbase(main):004:0> scan 'students'
ROW                             COLUMN+CELL                                                                             
 001                            column=info:age, timestamp=1486553121222, value=25                                      
 001                            column=info:name, timestamp=1486553116832, value=zacks                                  
1 row(s) in 0.1040 seconds

hbase(main):005:0> get 'students','001'
COLUMN                          CELL                                                                                    
 info:age                       timestamp=1486553121222, value=25                                                       
 info:name                      timestamp=1486553116832, value=zacks                                                    
2 row(s) in 0.1310 seconds

hbase(main):006:0> get 'students','001','info:name'
COLUMN                          CELL                                                                                    
 info:name                      timestamp=1486553116832, value=zacks                                                    
1 row(s) in 0.0450 seconds

 

Ok,it’s Done

 

分类上一篇:     分类下一篇:无,已是最新文章

Leave a Reply