当前位置:   article > 正文

【Ubuntu】安装hbase

【Ubuntu】安装hbase

前提

需要安装java

安装 HBase

  1. 下载并解压 HBase 安装包:
wget https://dlcdn.apache.org/hbase/2.5.7/hbase-2.5.7-bin.tar.gz
tar -zxvf hbase-2.5.7-bin.tar.gz
  • 1
  • 2
  1. 配置 HBase 环境变量:
export HBASE_HOME=/path/to/hbase-2.5.7
export PATH=$PATH:$HBASE_HOME/bin
  • 1
  • 2

启动 HBase

  1. 启动 HBase:
cd hbase-2.5.7/bin
./start-hbase.sh
  • 1
  • 2

关闭HBase

  1. 关闭HBase
cd hbase-2.5.7/bin
./stop-hbase.sh
  • 1
  • 2

使用 HBase Shell

  1. 打开终端(命令行界面)。
  2. 输入以下命令
hbase shell
  • 1

基础查询和修改

一旦进入 HBase Shell,可以执行各种查询和修改操作。以下是一些基本的查询和修改命令示例:

  • 创建表:
create 'my_table', 'column_family'
  • 1
  • 插入数据:
put 'my_table', 'row1', 'column_family:column1', 'value1'
  • 1
  • 获取数据:
get 'my_table', 'row1'
  • 1
  • 扫描表:
scan 'my_table'
  • 1
  • 删除数据:
delete 'my_table', 'row1', 'column_family:column1'
  • 1
  • 删除表:
disable 'my_table'
drop 'my_table'
  • 1
  • 2

如何连接远程hbase服务

  1. 修改hbase-site.xml,位于hbase-2.5.7/conf下,配置如下
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>aaa.bbb.ccc.com:12345</value>
  </property>
  <property>
    <name>hbase.client.username</name>
    <value>admin</value>
  </property>
  <property>
    <name>hbase.client.password</name>
    <value>admin</value>
  </property>
</configuration>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  1. 执行hbase shell
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/55282
推荐阅读
相关标签
  

闽ICP备14008679号