status 查看系统状态

hbase(main):010:0> status
1 active master, 0 backup masters, 4 servers, 0 dead, 6.5000 average load

version 查看版本号

hbase(main):011:0> version
1.2.0-cdh5.7.2, rUnknown, Fri Jul 22 12:20:40 PDT 2016

table_help 查看提示信息

hbase(main):012:0> table_help
Help for table-reference commands. You can either create a table via 'create' and then manipulate the table via commands like 'put', 'get', etc.
See the standard help information for how to use each of these commands. However, as of 0.96, you can also get a reference to a table, on which you can invoke commands.
For instance, you can get create a table and keep around a reference to it via: hbase> t = create 't', 'cf' Or, if you have already created the table, you can get a reference to it: hbase> t = get_table 't' You can do things like call 'put' on the table: hbase> t.put 'r', 'cf:q', 'v' which puts a row 'r' with column family 'cf', qualifier 'q' and value 'v' into table t. To read the data out, you can scan the table: hbase> t.scan which will read all the rows in table 't'. Essentially, any command that takes a table name can also be done via table reference.
Other commands include things like: get, delete, deleteall,
get_all_columns, get_counter, count, incr. These functions, along with
the standard JRuby object methods are also available via tab completion. For more information on how to use each of these commands, you can also just type: hbase> t.help 'scan' which will output more information on how to use that command. You can also do general admin actions directly on a table; things like enable, disable,
flush and drop just by typing: hbase> t.enable
hbase> t.flush
hbase> t.disable
hbase> t.drop Note that after dropping a table, your reference to it becomes useless and further usage
is undefined (and not recommended).

表的管理

create 创建表

hbase(main):014:0> create 'xt','xcf'
0 row(s) in 2.5340 seconds => Hbase::Table - xt
hbase(main):015:0>

list 查看表

hbase(main):015:0> list
TABLE
...
xt
17 row(s) in 0.0200 seconds => [..."xt"]
hbase(main):016:0>

describe 表的描述

hbase(main):017:0> describe 'xt'
Table xt is ENABLED
xt
COLUMN FAMILIES DESCRIPTION
{NAME => 'xcf', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE',
TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
1 row(s) in 0.0500 seconds

disable 表的禁用

hbase(main):038:0> disable 'xt'
0 row(s) in 8.7530 seconds

drop 表的删除

hbase(main):039:0> drop 'xt'
0 row(s) in 2.3130 seconds

exsits 判断是否存在

hbase(main):040:0> exists 'xt'
Table xt does not exist
0 row(s) in 0.0110 seconds

数据操作

put 增加和修改数据

向指定的列族中插入数据

hbase(main):019:0> put 'xt','1','xcf:col_name1','col_value1'
0 row(s) in 0.0080 seconds hbase(main):020:0> put 'xt','1','xcf:col_name2','col_value2'
0 row(s) in 0.0050 seconds

get 查询数据

hbase(main):021:0> get 'xt','1'
COLUMN CELL
xcf:col_name1 timestamp=1496997489039, value=col_value1
xcf:col_name2 timestamp=1496997502916, value=col_value2
2 row(s) in 0.0110 seconds hbase(main):022:0> get 'xt','1',{COLUMN => 'xcf:col_name1'}
COLUMN CELL
xcf:col_name1 timestamp=1496997489039, value=col_value1
1 row(s) in 0.0520 seconds hbase(main):023:0>

delete 删除数据

hbase(main):023:0> delete 'xt','1','xcf:col_name1'
0 row(s) in 0.0280 seconds hbase(main):024:0> get 'xt','1'
COLUMN CELL
xcf:col_name2 timestamp=1496997502916, value=col_value2
1 row(s) in 0.0030 seconds hbase(main):026:0> deleteall 'xt','1'
0 row(s) in 0.0030 seconds hbase(main):028:0> get 'xt','1'
COLUMN CELL
0 row(s) in 0.0070 seconds

scan 扫描全部数据

hbase(main):029:0> put 'xt','1','xcf:col1','123'
0 row(s) in 0.0230 seconds hbase(main):030:0> put 'xt','2','xcf:col1','123'
0 row(s) in 0.0040 seconds hbase(main):031:0> put 'xt','3','xcf:col1','123'
0 row(s) in 0.0040 seconds hbase(main):032:0> put 'xt','4','xcf:col1','123'
0 row(s) in 0.0040 seconds hbase(main):033:0> scan 'xt'
ROW COLUMN+CELL
1 column=xcf:col1, timestamp=1496998219258, value=123
2 column=xcf:col1, timestamp=1496998223993, value=123
3 column=xcf:col1, timestamp=1496998227824, value=123
4 column=xcf:col1, timestamp=1496998230678, value=123
4 row(s) in 0.0140 seconds

count 统计表个数

hbase(main):034:0> count 'xt'
4 row(s) in 0.0170 seconds => 4

truncate 清空表数据

hbase(main):035:0> truncate 'xt'
Truncating 'xt' table (it may take a while):
- Disabling table...
- Truncating table...
0 row(s) in 104.8850 seconds hbase(main):036:0> count 'xt'
0 row(s) in 23.6480 seconds => 0
hbase(main):037:0>

Hbase常用Shell命令的更多相关文章

  1. 原 HBase 常用Shell命令

    HBase 常用Shell命令 1.进入hbase shell console $HBASE_HOME/bin/hbase shell 如果有kerberos认证,需要事先使用相应的keytab进行一 ...

  2. (转)HBase 常用Shell命令

    转自:http://my.oschina.net/u/189445/blog/595232 hbase shell命令                             描述  alter 修改 ...

  3. HBase 常用Shell命令

    两个月前使用过hbase,现在最基本的命令都淡忘了,留一个备查~ 进入hbase shell console$HBASE_HOME/bin/hbase shell如果有kerberos认证,需要事先使 ...

  4. 5 HBase 常用Shell命令

    进入hbase shell console $HBASE_HOME/bin/hbase shell 如果有kerberos认证,需要事先使用相应的keytab进行一下认证(使用kinit命令),认证成 ...

  5. HBase 学习之路(五)——HBase常用 Shell 命令

    一.基本命令 打开Hbase Shell: # hbase shell 1.1 获取帮助 # 获取帮助 help # 获取命令的详细信息 help 'status' 1.2 查看服务器状态 statu ...

  6. HBase 系列(五)——HBase 常用 Shell 命令

    一.基本命令 打开 Hbase Shell: # hbase shell 1.1 获取帮助 # 获取帮助 help # 获取命令的详细信息 help 'status' 1.2 查看服务器状态 stat ...

  7. HBase 安装与配置及常用Shell命令

    HBase 安装与配置 首要配置 配置时间同步(所有节点上执行) yum -y install chrony vi /etc/chrony.conf #写入(7版本用server:8版本用pool): ...

  8. HBase基本shell命令

    HBase基本shell命令 以下shell命令都是经过测试,正常展示,若有不足,还望指点! 1.创建表 create ‘表名称’,‘列族名称1’,‘列族名称1’create 'test_M_01', ...

  9. HBase的Shell命令

    1.HBase提供了一个shell的终端给用户交互 2.HBase Shell的DDL操作 (1)先进入HBase的 Shell命令行,即HBASE_HOME/bin/hbase shell …… & ...

随机推荐

  1. tomcat6和tomcat7管理用户manager配置

    tomcat用户登录文件配置 如果想要对部署在tomcat上的项目进行管理查看,需要在tomcat安装目录conf文件夹下的tomcat-user.xml里添加用户登录权限.具体添加的内容如下: To ...

  2. C++ code:剩余串排列

    方法一: 一种直观的解是,先对第一个字串排序,然后逐个字符在第二个字串中搜索,把搜索不到的字符输出,就是所要的结果. 然而,算法库中有一个集合差运算set_difference,而且要求两个集合容器是 ...

  3. C++ code:数值计算之矩形法求解积分问题

    积分的通常方法是将区域切割成一个个的小矩形,然后求这些小矩形的和.小矩形切割得越细,计算精度就越高,可以将切割小矩形的数量作为循环迭代变量,将前后两个不同精度下的小矩形和之差,作为逼近是否达到要求的比 ...

  4. poj2155二维树状数组区间更新

    垃圾poj又交不上题了,也不知道自己写的对不对 /* 给定一个矩阵,初始化为0:两种操作 第一种把一块子矩阵里的值翻转:0->1,1->0 第二种询问某个单元的值 直接累计单元格被覆盖的次 ...

  5. 有关列分组,定义css样式无效的问题

    声明: web前端学习笔记,欢迎大神指点.联系QQ:1522025433. 有时候我们要单独对表格的某列定义单独的样式,就会很自然的想到 表格的 在<table>标签内使用的 <co ...

  6. [转] css自定义字体font-face的兼容和使用

    @Font-face目前浏览器的兼容性: Webkit/Safari(3.2+) TrueType/OpenType TT (.ttf) .OpenType PS (.otf): Opera (10+ ...

  7. 关于Jar包 和 war

    Jar包: 别人写好的java类打包,将这些jar包引入你的项目中,然后就可以直接使用这些jar包中的类和属性以及方法,一般都会放在lib目录下 war 是web项目

  8. mybatis DATE_FORMAT 格式化时间输出

    参考:http://www.cnblogs.com/yangy608/p/3950095.html 一.在oracle中,当想把字符串为‘2011-09-20 08:30:45’的格式转化为日期格式, ...

  9. 用VScode代码调试Python

    Python扩展支持许多类型的Python应用程序的调试,包括以下一般功能: 观看窗口 评估表达式 当地人 参数 扩大孩子 断点 条件断点 暂停(进入)正在运行的程序 自定义启动目录 要熟悉这些常规功 ...

  10. JAVA "GMT+10" 和 "GMT+0010"

    可以使用 getAvailableIDs 方法来对所有受支持的时区 ID 进行迭代.可以选择受支持的 ID 来获得 TimeZone.如果想要的时区无法用受支持的 ID 之一表示,那么可以指定自定义时 ...