参考官方文档

整体实现框架

图1

以下几个为组成部件

21892 HMaster
22028 HRegionServer
21553 QuorumPeerMain
2366 NameNode
2539 DataNode

配置

1.配置 hbase-env.sh

# JAVA_HOME
export JAVA_HOME=/opt/softwares/jdk1.8.0_141 # 使用自己的 Zookeeper
export HBASE_MANAGES_ZK=false

2.配置 hbase-site.xml(Example Distributed HBase Cluster)

<configuration>
<!--根目录,在HDFS的路径-->
<property>
<name>hbase.rootdir</name>
<value>hdfs://cen-ubuntu.cenzhongman.com:8020/hbase</value>
</property>
<!--是否分布式-->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<!--所有节点,逗号隔开-->
<property>
<name>hbase.zookeeper.quorum</name>
<value>cen-ubuntu.cenzhongman.com</value>
</property>
</configuration>

3.配置 regionservers 类似(Slaves)

cen-ubuntu

启动

1.启动 Zookeper server

$ bin/zkServer.sh start

2.启动 HBase

$ bin/start-hbase.sh

3.Web 查看

$ hostname:60010

使用

基础

1.Connect to HBase.

Connect to your running instance of HBase using the hbase shell command, located in the bin/ directory of your HBase install. In this example, some usage and version information that is printed when you start HBase Shell has been omitted. The HBase Shell prompt ends with a > character.

$ ./bin/hbase shell
hbase(main):001:0>

2.Display HBase Shell Help Text.

Type help and press Enter, to display some basic usage information for HBase Shell, as well as several example commands. Notice that table names, rows, columns all must be enclosed in quote characters.

hbase(main):001:0> help
hbase(main):001:0> help 'create'

3.List Information About your Table

Use the list command to

hbase(main):002:0> list 'test'
TABLE
test
1 row(s) in 0.0180 seconds => ["test"]

1.Create a table.

Use the create command to create a new table. You must specify the table name and the ColumnFamily name.

hbase(main):001:0> create 'test', 'cf'
0 row(s) in 0.4170 seconds => Hbase::Table - test

2.Put data into your table.

To put data into your table, use the put command.

# 表名   RowKey   列簇名[:列名]  值   [timeStamp]可指定,默认为时间戳
hbase(main):003:0> put 'test', 'row1', 'cf:a', 'value1'
0 row(s) in 0.0850 seconds hbase(main):004:0> put 'test', 'row2', 'cf:b', 'value2'
0 row(s) in 0.0110 seconds hbase(main):005:0> put 'test', 'row3', 'cf:c', 'value3'
0 row(s) in 0.0100 seconds

查询(三种方式)

1.Scan the table for all data at once.全表扫描

One of the ways to get data from HBase is to scan. Use the scan command to scan the table for data. You can limit your scan, but for now, all data is fetched.

hbase(main):006:0> scan 'test'
ROW COLUMN+CELL
row1 column=cf:a, timestamp=1421762485768, value=value1
row2 column=cf:b, timestamp=1421762491785, value=value2
row3 column=cf:c, timestamp=1421762496210, value=value3
3 row(s) in 0.0230 seconds

2.Get a single row of data.单行查询(最快速)

To get a single row of data at a time, use the get command.

# 表名  RowKey  [列簇名[:列名]]  [timeStamp]
hbase(main):007:0> get 'test', 'row1'
COLUMN CELL
cf:a timestamp=1421762485768, value=value1
1 row(s) in 0.0350 seconds

3.范围查询

给定条件按范围进行列查询

hbase(main):007:0> scan 'test' ,{STARTROW => 'xyz'}

1.Disable a table.

If you want to delete a table or change its settings, as well as in some other situations, you need to disable the table first, using the disable command. You can re-enable it using the enable command.

hbase(main):008:0> disable 'test'
0 row(s) in 1.1820 seconds hbase(main):009:0> enable 'test'
0 row(s) in 0.1770 seconds

Disable the table again if you tested the enable command above:

hbase(main):010:0> disable 'test'
0 row(s) in 1.1820 seconds

2.Drop the table.

To drop (delete) a table, use the drop command.

hbase(main):011:0> drop 'test'
0 row(s) in 0.1370 seconds

3.Delete Data

To Delect data from table.

# 删除一行中一列数据(不能根据列簇所属的列的数据,但是能删除列簇的自己数据)
hbase(main):011:0> delete 't1','r1','c1',['ts1'] # 删除整行数据
hbase(main):011:0> deleteall 't1','r1'

Exit the HBase Shell.

To exit the HBase Shell and disconnect from your cluster, use the quit command. HBase is still running in the background.

hbase(main):007:0> quit/exit

Stop HBase

In the same way that the bin/start-hbase.sh script is provided to conveniently start all HBase daemons, the bin/stop-hbase.sh script stops them.

$ ./bin/stop-hbase.sh
stopping hbase....................

HBase配置和使用的更多相关文章

  1. HBase配置&启动脚本分析

    本文档基于hbase-0.96.1.1-cdh5.0.2,对HBase配置&启动脚本进行分析 date:2016/8/4 author:wangxl HBase配置&启动脚本分析 剔除 ...

  2. Hadoop 管理工具HUE配置-HBase配置

    1 前言 首先要陪只好HBase,可以参见http://www.cnblogs.com/liuchangchun/p/4096891.html,完全分布式类似 2 HBase配置 2.1 HUE 配置 ...

  3. hbase总结~hbase配置和使用

    Base配置和使用文档......................................................................................... ...

  4. Hadoop学习---Zookeeper+Hbase配置学习

    软件版本号: JDK:jdk-8u45-linux-i586.tar.gz Zookeeper:zookeeper-3.4.6 Hbase:hbase-1.0.0-bin 一.JDK版本更换 由于之前 ...

  5. 【原创】 HBase 配置指南

    HBase 默认配置   Centos6.5下Hbase配置 官网配置文档:http://hbase.apache.org/book.html#_configuration_files 中文翻译转自: ...

  6. hbase配置详解(转)

    转自:http://www.cnblogs.com/viviman/archive/2013/03/21/2973539.html 1 准备工作 因为我只有一台机器,所以,一切都成为了伪分布,但是,其 ...

  7. HBase配置性能调优(转)

    因官方Book Performance Tuning部分章节没有按配置项进行索引,不能达到快速查阅的效果.所以我以配置项驱动,重新整理了原文,并补充一些自己的理解,如有错误,欢迎指正. 配置优化 zo ...

  8. Hbase配置中出现的问题总结

    在create table的时候出现例如以下问题 1. ERROR: java.io.IOException: Table Namespace Manager not ready yet, try a ...

  9. Hbase配置java客户端

    1.修改windows配置文件 C:\WINDOWS\system32\drivers\etc\hosts 将远程hbase和zookeeper主机的IP地址加进去 54.0.88.53      H ...

  10. Hbase配置WEB UI界面

    1 找到各个节点下面的Hbase-site.xml文件,添加如下配置 <property> <name>hbase.master.info.port</name> ...

随机推荐

  1. 如何从ERP将Material的Batch信息下载到CRM并存储在settype COMM_PR_BATCH里

    前提条件:必须先确保三个对象ATTRIBUTE, CLASS和OBJCL成功下载.可以到事物码R3AM1里查看,确保状态全部为Done. (1) 在事物码MM02里,切换到视图classificati ...

  2. TCP的建立和关闭

    一.TCP头信息 简单的至少应该知道,源端口,目的端口,序号,确认号,标志位,校验和 二.TCP的建立 1.客户端将SYN标志位置1,同时生成随机的序号,确认号是0. 2.服务器接收到SYN,知道有人 ...

  3. 设计模式——装饰模式(Decorator Pattern)

    装饰模式:动态的给一个对象添加一些额外的职责,就增加功能来说,装饰模式比生成子类更为灵活. UML图: 模型类: Component类: package com.cnblog.clarck; /** ...

  4. Ajax系列之三:UpdatePanel

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/zhanghongjie0302/article/details/35609691           ...

  5. CodeForces 30C Shooting Gallery 简单dp

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/qq574857122/article/details/36944227 题目链接:点击打开链接 给定 ...

  6. 【BZOJ1171】大sz的游戏(线段树+单调队列)

    点此看题面 大致题意: 有\(n\)个点,两点间最大通讯距离为\(L\).已知除\(1\)号点外第\(i\)个点能够发出和接收的信号区间\([l_i,r_i]\)以及到\(1\)号点的距离\(dis_ ...

  7. Android——HelloWorld

    今天正式加入实验室做安卓,看上去无从下手,让我想到当年学ACM一样,但是也一直搞过来了,现在又是一个新的起点. 废话不多说~~~ Hello World 安装: JDK SDK Eclipse 参考: ...

  8. PHP语言开发微信公众平台(订阅号)之注册(1)

    1.百度搜索"微信公众平台" 2.选择微信公众平台官网并单击打开 3.进入官网页面,单击 "立即注册" 进入注册页面 4.进入注册页面,单击订阅号 5.进入订阅 ...

  9. winform 实现彩票功能

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/MrTraum/article/details/32702319 watermark/2/text/a ...

  10. VMWARE下CentOS7虚拟机网络配置

    注:本文仅针对新装的虚拟机,#ip addr 获取不到ip信息,无法连接网络的情况提供一种参考解决方案. 1.左上角点击“编辑”->“虚拟网络编辑器”.新建一个NAT模式的网络. 2.配置虚拟机 ...