Hbase 组件单机部署

1、 解压Hbase安装包到“/usr/project”路径;

tar zxvf hbase-1.2.3-bin.tar.gz -C /usr/project/

2、 修改解压后文件夹名为hbase;

mv hbase-1.2.3/ hbase

3、 设置Hbase环境变量,并使环境变量只对当前root用户生效;

vi ~/.base_profile  或者vi ~/.bashrc?

export HBASE_HOME=/usr/project/hbase
export PATH=$PATH:$HBASE_HOME/bin

4、 修改配置hbase-env.sh文件;

vi hbase-env.sh

export JAVA_HOME=/usr/java/jdk
export HBASE_CLASSPATH=/usr/project/hadoop/conf
export HBASE_MANAGES_ZK=true

5、 修改配置hbase-site.xml

<configuration>
        <property>
                <name>hbase.rootdir</name>
                <value>hdfs://master:9000/hbase</value>
        </property>
        <property>
                <name>hbase.cluster.distributed</name>
                <value>true</value>
        </property>
</configuration>


<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.master</name>
<value>hdfs://master:60000</value>
</property>

<property>
<name>hbase.zookeeper.quorum</name>
<value>host1,host2,host3</value>
<description>Comma separated list of servers in the ZooKeeper Quorum. For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com". By default this is set to localhost for local and pseudo-distributed modes of operation. For a fully-distributed setup, this should be set to a full list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh this is the list of servers which we will start/stop ZooKeeper on. </description>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/zookeeper</value>
<description>Property from ZooKeeper's config zoo.cfg. The directory where the snapshot is stored. </description>
</property>
</configuration>

6、 查看hbase是否安装成功

[root@master ~]# jps
15810 DataNode
15684 NameNode
16102 ResourceManager
15962 SecondaryNameNode
16571 Jps
16204 NodeManager

[root@slave2 hbase]# jps
6240 HQuorumPeer
6448 HRegionServer
6329 HMaster
5819 DataNode
5916 NodeManager
6606 Jps

7、 启动Hbase;

[root@slave2 hbase]# bin/start-hbase.sh

start-hbase.sh

8、 用Hbase shell 访问

hbase shell

9、 创建Hbase数据库表;

create 'student','Sname','Ssex','Sage','Sdept','course'

list

["student"]

10、查看Hbase版本信息

hbase version

results matching ""

    No results matching ""