鍍金池/ 教程/ 大數(shù)據(jù)/ HBase計數(shù)和截斷
HBase禁用表
HBase創(chuàng)建表
HBase客戶端API
HBase安裝
HBase表描述和修改
HBase Admin API
HBase掃描
HBase創(chuàng)建數(shù)據(jù)
HBase列出表
HBase刪除數(shù)據(jù)
HBase讀取數(shù)據(jù)
HBase常用命令
HBase更新數(shù)據(jù)
HBase關(guān)閉
HBase架構(gòu)
HBase Shell
HBase Exists
HBase安全
HBase教程
HBase啟用表
HBase計數(shù)和截斷
HBase刪除表

HBase計數(shù)和截斷

count

可以使用count命令計算表的行數(shù)量。它的語法如下:

count ‘<table name>’ 

刪除第一行后,表emp就只有兩行。驗證它,如下圖所示。

hbase(main):023:0> count 'emp'
2 row(s) in 0.090 seconds
=> 2 

truncate

此命令將禁止刪除并重新創(chuàng)建一個表。truncate 的語法如下:

hbase> truncate 'table name'

下面給出是 truncate 命令的例子。在這里,我們已經(jīng)截斷了emp表。

hbase(main):011:0> truncate 'emp'
Truncating 'one' table (it may take a while):
   - Disabling table...
   - Truncating table...
  0 row(s) in 1.5950 seconds

截斷表之后,使用scan 命令來驗證。會得到表的行數(shù)為零。

hbase(main):017:0> scan emp
ROW                  COLUMN+CELL
0 row(s) in 0.3110 seconds

上一篇:HBase啟用表下一篇:HBase安全