HBase_在Linux上安装以及运用

1.上传解压文件

文件:hbase-1.0.1.1-bin.tar

2.更改配置文件

   在hbase-env.sh中,

      export JAVA_HOME=/home/lang/software/jdk1.8.0_121

      export HBASE_MANAGES_ZK=true

   

   在hbase-site.xml中

     <configuration>

        <property>

           <name>hbase.rootdir</name>

           <value>file:///home/lang/software/hbase</value>

        </property>

        <property>

           <name>hbase.zookeeper.property.dataDir</name>

           <value>/home/lang/software/zookeeper</value>

        </property>

     </configuration>

3.启动hbase

   $HBASE_HOME/bin/start-hbase.sh

打开jps如下图所示:

《HBase_在Linux上安装以及运用》

4.关闭hbase

   $HBASE_HOME/bin/stop-hbase.sh

5.进入HBase shell

5.0 $HBASE_HOME/bin/hbase shell

《HBase_在Linux上安装以及运用》

5.1创建表students,两个列族:info ,address

《HBase_在Linux上安装以及运用》

5.2 添加数据

put ‘students’,’zhangsan’,’info:sno’,’001′

put ‘students’,’zhangsan’,’info:sname’,’张三’

put ‘students’,’zhangsan’,’address’,’天津’

《HBase_在Linux上安装以及运用》

5.3查询数据

get ‘students’,’zhangsan’

《HBase_在Linux上安装以及运用》

5.4 更新数据

《HBase_在Linux上安装以及运用》

5.5 删除数据

delete ‘students’,’zhangsan’,’address’

《HBase_在Linux上安装以及运用》

5.6 统计表的行数

count ‘students’

《HBase_在Linux上安装以及运用》

5.7 清空表

truncate  ‘students

《HBase_在Linux上安装以及运用》

5.8 删除表

disable  ‘students’

drop  ‘students’

《HBase_在Linux上安装以及运用》

6.列族的数量是固定的,列的数量是添加数据时写

7.伪分布式安装将数据文件存储到HDFS上

修改hbase-site.xml文件:

 

    <configuration>

        <property>

           <name>hbase.cluster.distributed</name>

           <value>true</value>

        </property>

 

        <property>

           <name>hbase.rootdir</name>

           <value>hdfs://localhost:9000/hbase</value>

        </property>

        <property>

           <name>hbase.zookeeper.property.dataDir</name>

           <value>/home/lang/software/zookeeper</value>

        </property>

     </configuration>

在hdfs上建立hbase文件夹

《HBase_在Linux上安装以及运用》

 

    原文作者:hbase
    原文地址: https://www.cnblogs.com/langgj/p/6668227.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞