《自己动手写云盘》 – 搭建Hbase环境

 人个主页链接:http://www.tongtongxue.com/archives/4669.html

  软件准备

1、zookeeper-3.4.9.tar.gz

2、hbase-1.1.7-bin.tar.gz

  安装Zookeeper

由于Hbase的需要zookpeeper的协同管理,所以先把Zookeeper安装好。

1、首先从Apache网站将zookeeper下载下来;

2、将zookeeper安装包通过xshell工具上传到linux服务器上,然后输入解压命令:

tar -zxvf zookeeper-3.4.9.tar.gz

 3、进入conf文件夹,新建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.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/opt/zookeeper/data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

 4、配置环境变量

打开配置环境变量文件

vi /etc/profile

 配置如下信息

export ZOOKEEPER_HOME=/opt/zookeeper
export PATH=$JAVA_HOME/bin:$HADOOP_HOME/bin:$ZOOKEEPER_HOME/bin:$PATH

 5、启动Zookeeper

在启动zookeeper之前,可以先将hadoop的hdfs环境启动直起来,即

sbin/start-dfs.sh

 然后启动zookeeper

zkServer.sh start 

  安装Hbase

1、在Apache网站中下载hbase;

2、将文件上传到linux服务器,解压文件

tar -zxvf hbase-1.1.7-bin.tar.gz

 3、配置环境变量

export HBASE_HOME=/opt/hbase
export PATH=$JAVA_HOME/bin:$HADOOP_HOME/bin:$ZOOKEEPER_HOME/bin:$HBASE_HOME/bin:$PATH

 4、编辑hbase-env.sh

在conf文件夹中,找到hbase-env.sh,修改如下:

# The java implementation to use.  Java 1.7+ required.
export JAVA_HOME=/opt/jdk1.7.0_67

# Extra Java CLASSPATH elements.  Optional.
export HBASE_CLASSPATH=/opt/hadoop/etc/hadoop

# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=true

 5、编辑hbase-site.xml

在conf文件夹中,找到hbase-site.xml文件,配置成:

<configuration>
        <property>
                <name>hbase.rootdir</name>
                <value>hdfs://yunpan:9000/hbase</value>
        </property>

        <property>
                <name>hbase.zookeeper.quorum</name>
                <value>yunpan</value>
        </property>

        <property>
                <name>hbase.cluster.distributed</name>
                <value>true</value>
        </property>
</configuration>

 6、启动Hbase

start-hbase.sh 

   关注微信公众号


《自己动手写云盘》 – 搭建Hbase环境