HBase命令 三 增刪改查

2022-02-07 02:53:34 字數 1796 閱讀 7239

新增

//

語法:put ,,,,

//新增或者覆蓋資料 put '表名','鍵名','列名(不是列簇名)','值'

//指定的列名下單元格有值就覆蓋..沒有值就建立.所以hbase的新增資料和修改資料都是put語句..

//最後的時間戳可以不寫..預設為系統時間,如果要寫..切記不可使用引號括起來

hbase shell> put '

mytable

','woshikey

','ct:msg

','99999999999999

'hbase shell> put '

mytable

','woshikey

','ct:msg

','99999999999999

',1462241148

刪除

//

刪除某個單元值的值 會刪除所有版本

//語法:delete , , , ,必須指定列名

//測試後發現後邊跟時間戳也沒有用,依然會刪除所有版本

hbase shell> delete '

mytable

','rowkey

','ct:msg'//

刪除行或者整個列簇

//語法:deleteall , , , ,可以不指定列名,刪除整行資料

hbase shell> deleteall '

mytable

','ct

'hbase shell> deleteall '

mytable'//

清空表資料

//語法: truncate

//等同於 disable -> drop -> create

hbase shell> truncate '

mytable

'

查詢   

//

掃瞄表//

語法: scan ,

hbase shell> scan '

mytable

'hbase shell> scan '

mytable

',hbase shell> scan '

mytable

', //

返回所屬列簇裡每個列的第乙個值

hbase shell> scan '

mytable

',//

獲取表資料

//語法: get ,[,]

hbase shell> get

'mytable

','rowkey1

'hbase shell> get

'mytable

','rowkey1

','ct

'hbase shell> get

'mytable

','rowkey1

','ct:msg

'hbase shell> get

'mytable

','rowkey1

',hbase shell> get

'mytable

','rowkey1

',//

獲取錶行數

//語法:count ,

//interval設定多少行顯示一次及對應的rowkey,預設1000;cache每次去取的快取區大小,預設是10,調整該引數可提高查詢速度

//例如,查詢表t1中的行數,每100條顯示一次,快取區為500

hbase shell> count '

mytable

',

hbase 增刪改查

兩篇可以參考的文章,講的不錯 hbase web操作 訪問位址 http hmaster 60010,hmaster的ip配置在 hbase home conf hbase site.xml中 ip對映成主機名,在env hosts中配置 在windows系統中的c windows system32...

hbase學習筆記 增刪改查操作

org.apache.hbasegroupid hbase clientartifactid 1.2.1version dependency org.apache.hbasegroupid hbase commonartifactid 1.2.1version dependency junitgro...

Hbase增刪改查真正面目

hbase是如何實現增刪改查的?真實的情況是這樣的 hbase幾乎總是在做新增操作。當新增乙個cell的時候,hbase在hdfs上新增一條資料,型別是put。當修改乙個cell的時候,hbase在hdfs又新增一條資料,只是版本號比之前那個大 或者自己定義 當刪除乙個cell的時候,hbase還是...