Linux下HBase-0.98.5安装配置之伪分布模式

来源:互联网 发布:mac keynote 模版 编辑:程序博客网 时间:2024/05/17 01:38

            HBase安装模式有三种:单机模式、分布式(伪分布式和完全分布式)。本教程介绍了HBase的伪分布式模式安装配置的过程,伪分布式模式是把进程运行在一台机器上,但不是同一个JVM(单机模式),分布式模式的安装配置需要依赖于HDFS

一.环境说明

         JDK1.7+

         Hadoop-2.4.0

         Ubuntu13.10

二.安装配置

            1.下载hbase-0.98.5

            官网下载地址:http://mirrors.cnnic.cn/apache/hbase/,下载hadoop2版本:hbase-0.98.5-hadoop2-bin.tar.gz 

            解压软件包:

tar -zvxf hbase-0.98.5-hadoop2-bin.tar.gz
           重命名(包名太长不方便),复制到hadoop所在目录,我的放在/opt目录下:
mv hbase-0.98.5-hadoop2 hbasecp hbase /opt/hbase

            2.配置环境变量

vi /etc/profileexport HBASE_HOME=/opt/hbaseexport PATH=$PATH:$HBASE_HOME/bin

            执行source /etc/profile ,使更改后的profile生效

       3.配置HBase

       修改配置文件hbse-site.xml

gedit $HBASE_HOME/conf/hbase-site.xml
<configuration> <property>        <name>hbase.rootdir</name>        <value>hdfs://localhost:9000/hbase</value>        <description></description> </property> <property>        <name>dfs.replication</name>        <value>1</value>        <description></description> </property> <property>        <name>hbase.cluster.distributed</name> <value>true</value></property><property><name>hbase.master</name><value>localhost:60000</value></property><property> <name>hbase.zookeeper.quorum</name> <value>localhost</value></property></configuration>
            修改配置文件hbase-env.sh
gedit $HBASE_HOME/conf/hbase-env.sh
export JAVA_HOME=/home/dashengong/jdk1.7.0_40export HBASE_MANAGES_ZK=true
          修改配置文件regionservers,类似hadoop的salve文件

localhost
           最后将hadoop下的hdfs-site.xml拷贝到$HBASE_HOME/conf下

cp $HADOOP_HOME/etc/hadoop/hdfs-site.xml $HBASE_HOME/conf

三.启动HBase

           用如下命令启动和关闭Hbase: start-hbase.sh     stop-hbase.sh
       注意:必须先启动Hadoop,再启动Hbase;先关闭Hbase,再关闭Hadoop

start-hbase.sh localhost: starting zookeeper, logging to /opt/hbase-0.98.2-hadoop2/bin/../logs/hbase-root-zookeeper-Ubuntu-Kylin.outstarting master, logging to /opt/hbase-0.98.2-hadoop2/logs/hbase-root-master-Ubuntu-Kylin.outlocalhost: starting regionserver, logging to /opt/hbase-0.98.2-hadoop2/bin/../logs/hbase-root-regionserver-Ubuntu-Kylin.out
          启动后,使用jps查看Hbase进程:

root@Ubuntu-Kylin:/# jps7846 Jps7275 HQuorumPeer6346 SecondaryNameNode6688 NodeManager6042 NameNode6550 ResourceManager7340 HMaster7504 HRegionServer6175 DataNode
          如有错误或Hbase进程未启动,可通过log来查看启动过程信息。

四.HBase shell

           用如下命令进入Hbase: hbase shell

$ hbase shell2014-03-10 10:45:17,409 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.availableHBase Shell; enter 'help<RETURN>' for list of supported commands.Type "exit<RETURN>" to leave the HBase ShellVersion 0.98.0-hadoop2, r1565492, Thu Feb  6 16:46:57 PST 2014 hbase(main):001:0> create 'test_pseudo', 'cf'0 row(s) in 2.2370 seconds => Hbase::Table - test_pseudohbase(main):002:0> list 'test_pseudo' TABLE                                                                          test_pseudo                                                                    1 row(s) in 0.0590 seconds  => ["test_pseudo"]hbase(main):003:0> put 'test_pseudo', 'row1', 'cf:a', 'micmiu.com'0 row(s) in 0.0940 seconds  hbase(main):004:0> put 'test_pseudo', 'row2', 'cf:b', 'sjsky.iteye.com'0 row(s) in 0.0220 seconds  hbase(main):005:0> put 'test_pseudo', 'row3', 'cf:c', 'baby.micmiu.com'0 row(s) in 0.0220 seconds  hbase(main):006:0> scan 'test_pseudo'ROW                        COLUMN+CELL                                                              row1                      column=cf:a, timestamp=1394420980666, value=micmiu.com                   row2                      column=cf:b, timestamp=1394420985666, value=sjsky.iteye.com              row3                      column=cf:c, timestamp=1394420990144, value=baby.micmiu.com              3 row(s) in 0.0450 seconds  hbase(main):007:0> get 'test_pseudo','row1'COLUMN                     CELL                                                                     cf:a                      timestamp=1394420980666, value=micmiu.com                                1 row(s) in 0.0240 seconds  hbase(main):008:0> disable 'test_pseudo'0 row(s) in 15.6070 seconds  hbase(main):009:0> drop 'test_pseudo'0 row(s) in 5.2770 seconds
           至此,HBase配置完毕。







           



    

0 0
原创粉丝点击