创建HBase表出现 "xxxxx is disabled."

用hbase shell 创建表的时候出现:“SearchCount is disabled”

hbase(main):002:0> count 'SearchCount'

ERROR: org.apache.hadoop.hbase.DoNotRetryIOException: SearchCount is disabled.

Here is some help for this command:
Count the number of rows in a table. This operation may take a LONG
time (Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a
counting mapreduce job). Current count is shown every 1000 rows by
default. Count interval may be optionally specified. Scan caching
is enabled on count scans by default. Default cache size is 10 rows.
If your rows are small in size, you may want to increase this
parameter. Examples:

 hbase> count 't1'
 hbase> count 't1', INTERVAL => 100000
 hbase> count 't1', CACHE => 1000
 hbase> count 't1', INTERVAL => 10, CACHE => 1000

The same commands also can be run on a table reference. Suppose you had a reference
t to table 't1', the corresponding commands would be:

 hbase> t.count
 hbase> t.count INTERVAL => 100000
 hbase> t.count CACHE => 1000
 hbase> t.count INTERVAL => 10, CACHE => 1000

解决办法:

hbase(main):003:0> enable 'SearchCount'
0 row(s) in 2.1700 seconds

hbase(main):004:0> count 'SearchCount'
Current count: 1000, row: 0000001534
Current count: 2000, row: 0000002606
2055 row(s) in 7.2270 seconds

常见的hbase命令

  1. 启动 HBase Shell , 在 HBase 目录下执行
bin/hbase shell
注意: 在 HBase Shell 中如果按退格键无法删除 , 则需要按 Ctrl + backspace 键
  1. 建表 , 表名 scores , 有两个列簇 grade , course
get 't1','r1'
get 't1','r1','c1'
get 't1','r1','c1','c2'
create 'scores','grade','course'
  1. 查看 HBase 中的表

list
4. 查看表结构

describe 'scores'
  1. 向表中写入数据
put 't1','r1','c1','value',ts1
t1 : 表名 | r1 : 行键 | c1 : 列名 | value : 值 | ts1 : 数据的时间戳(一般都省略不设置)
put 'scores','Tom','grade',5            //qualifier为空
put 'scores','Tom','course:math',89     //qualifier不为空
  1. 随机查找数据 get
get 't1','r1'
get 't1','r1','c1'
get 't1','r1','c1:q1'
get 't1','r1','c1','c2'
get 't1','r1',{COLUMN=>'c1',TIMESTAMP=>ts1}
get 't1','r1',{COLUMN=>'c1',TIMERANGE=>[ts1,ts2],VERSIONS=>4}    //这里的VERSIONS暂时还不知道咋用
// 举个栗子
get 'scores','Tom','grade'
get 'scores','Tom','course:math'
get 'scores','Tom','grade','course'
  1. 范围查找数据 scan
scan 't1'
scan 't1',{COLUMNS=>'c1'}
scan 't1',{COLUMNS=>'c1:q1'}
scan 't1',{COLUMNS=>['c1','c2'],LIMIT=>10,STARTROW=>'xxx'}
scan 't1',{REVERSED=>true}   //反向查找
  1. 删除数据
delete 't1','r1','c1',ts1    // ts1我测试貌似没用
// 举例
delete 'scores','jim','course:math'
// 删除全表数据
truncate 'scores' 
  1. 修改表结构
// 添加一个列簇
alter 'scores',NAME=>'profile'
// 删除一个列簇
alter 'scores',NAME=>'profile',METHOD=>'delete'
  1. 删除表
// 分两步,先disable, 然后在 drop
disable 't1'
drop 't1'
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值