HBase - 計數和截斷



count

你可以使用 count 命令來計數表中的行數。它的語法如下

count ‘<table name>’ 

刪除第一行後,emp 表將有兩行。按以下方式驗證。

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

truncate

此命令停用刪除並重新建立一個表。truncate 的語法如下

hbase> truncate 'table name'

示例

以下是 truncate 命令示例。在此,我們截斷了 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 命令進行驗證。你將獲得一個有零行的表。

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