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

一笑奈何 提交于 2019-12-23 10:08:39

用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'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!