Linux下Hadoop(伪分布) + Zookeeper + HBase(一个节点) 部署

来源:互联网 发布:淘宝买aj最靠谱的店铺 编辑:程序博客网 时间:2024/06/14 01:36

下面将介绍,Hbase的部署过程。

前期准备:

1.安装配置好hadoop(我这里是伪分布),并确认能够使用

core-site.xml文件配置如下:

<configuration><property><name>fs.defaultFS</name><value>hdfs://172.16.43.10:9000</value></property><property><name>dfs.datanode.socket.write.timeout</name><value>3000000</value></property><property><name>dfs.socket.timeout</name><value>3000000</value></property><property>   <name>hadoop.tmp.dir</name>   <value>/home/hadoop/tmp</value>   <description>A base for other temporary directories.</description></property></configuration>

2.安装配置好Zookeeper(我在本机通过三个tomcat搭建了一个三个节点的环境)

第一个zoo.cfg:

# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=5# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=2# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=/home/hadoop/zookeeper/zookeeper0/datadataLogDir=/home/hadoop/zookeeper/zookeeper0/logs# the port at which the clients will connectclientPort=2181server.0=172.16.43.10:8880:7770server.1=172.16.43.10:8881:7771server.2=172.16.43.10:8882:7772
第二个:

# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=5# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=2# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=/home/hadoop/zookeeper/zookeeper0/datadataLogDir=/home/hadoop/zookeeper/zookeeper0/logs# the port at which the clients will connectclientPort=2182server.0=172.16.43.10:8880:7770server.1=172.16.43.10:8881:7771server.2=172.16.43.10:8882:7772
第三个:

# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=5# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=2# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=/home/hadoop/zookeeper/zookeeper0/datadataLogDir=/home/hadoop/zookeeper/zookeeper0/logs# the port at which the clients will connectclientPort=2182server.0=172.16.43.10:8880:7770server.1=172.16.43.10:8881:7771server.2=172.16.43.10:8882:7772
3.hbase-1.1.2-bin.tar 

一、正式开始部署

1.上传hbase-1.1.2-bin.tar到linux系统上,并解压(我解压在 /home/hadoop/hbase 文件夹中)

tar -zxvf hbase-1.1.2-bin.tar
:解压后,请确认好,该文件夹的权限,以免出现不必要的问题

2.开始配置hbase,进入 /home/hadoop/hbase/hbase-1.1.2/conf,并修改hbase-site.xml文件

cd /home/hadoop/hbase/hbase-1.1.2/confvi hbase-site.xml
修改后的hbase-site.xml内容为:

<configuration><property><name>hbase.rootdir</name><value>hdfs://hadoop:9000/hbase</value></property><property><name>hbase.cluster.distributed</name><value>true</value></property><property><name>hbase.master</name><value>hadoop:60000</value></property><property><name>hbase.zookeeper.quorum</name><value>172.16.43.10:2181,172.16.43.10:2182,172.16.43.10:2183</value></property><property><name>hbase.tmp.dir</name><value>/home/hadoop/hbase-tmp</value></property><property><name>hbase.master.info.port</name><value>60010</value></property></configuration>
注:1.hbase.rootdir 属性值设置时,请直接写主机名,我这里为 hadoop 对应的是 172.16.43.10

2.hbase.zookeeper.quorum 设置时,请根据Zookeeper的zoo.cfg配置文件的内容进行配置,这里需要制定端口号,如果直接写172.16.43.10,则Hbase只会去连接一个Zookeeper节点

3.需要配置hbase.master.info.port的值,否则在浏览器无法访问到Hbase管理界面,设置了后,直接访问 172.16.43.10:60010

3.修改hbase-ebv.sh

修改指定几个属性的内容为:

export JAVA_HOME=/home/hadoop/java/jdk1.7.0_75export HBASE_CLASSPATH=/home/hadoop/hadoop-src/hadoop-2.5.1/etc/hadoopexport HBASE_MANAGES_ZK=false
JAVA_HOME  为你安装的JAVA的目录

HBASE_CLASSPATH 为你安装的hadoop的配置文件的目录

 HBASE_MANAGES_ZK 设置为false 或者不设置,使用外部Zookeeper

4.修改完毕后,先确保hadoop,Zookeeper启动正常后,启动Hbase

cd /home/hadoop/hbase/hbase-1.1.2/bin./start-hbase.sh
注:如果出现错误,可以到logs文件夹底下进行相应的查看

5.简单验证是否启动成功,在bin目录下,进入hbase shell 客户端

./hbase shell
进入成功,则代表启动成功,或者直接在浏览器中访问 172.16.43.10:60010。

至此,Hbase部署完毕


0 0
原创粉丝点击