Hbase 基本shell操作命令

2021-06-27 18:52:20 字數 1091 閱讀 1243

1.建立表(hbase 建立表示要求必須確定列簇)

下面建立了乙個表名字為scores的表。其中有兩個列簇,乙個是grade,乙個是course;

create 'scores','grade','course'

2.檢視hbase中所有表

list

3 檢視表結構

describe 『scores』

4 插入資料

向scores表中插入一行,行健是tom,grade的值是5

put 'scores','tom','grade:','5'

向scores表中插入一行,行健是tom,列math,的值是80

put 'scores','tom','course:math','80'

向scores表中插入一行,行健是jim,grade的值是4

put 'scores','jim','grade','5'

向scores表中插入一行,行健是jim,列english,的值是90

put 'scores','tom','course:english,'80'

(hbase中的列是可以動態改變的)

5 刪除指定資料

delete 『scores』,'jim','grade'

deleteall 整個行的刪除

truncate 『scores』 全表刪除,結構還在

6 修改表結構

disable 'scores'

alter 'scores',name=>'info' 新增乙個列簇

enable 'scores'

7 刪除乙個列簇

alter 'scores',name=>'info',method=>'delete'

alter 'scores','delete'=>'info'

8 修改乙個列簇

將info列簇的版本數量改為3個

alter 『scores』,

9 統計行數

count 『scores』  使用mapreduce進行統計

count 『scores』 ,interval=>10,cache=>1000

預設統計1000行(interval)結果會進行快取

hbase的shell基本操作

1.建立表的時候必須要指定列族 student是表 info是列族 create student info 2.向表中加入資料 1001是行鍵 put student 1001 info name x put student 1001 info male put student 1001 info ...

hbase基本 shell命令

1.啟動hbase shell命令bin hbase shell2.表的操作 1 建表語句 create studnet info 這個是表名和列族 2 新增和修改資料 put student 1001 info name tom put表名,row key 列族 列名 值 3 檢視表資料 get ...

HBase 基本操作

如何新增列族很簡單,跟rdbms一樣 直接用alter,但是alter之前必須先disable這個表 disable test 先禁用,目前我用的hbase 0.92版本,尚需要先disable,後期版本不知是否可以不用disable alter test 直接alter 後邊寫入你要 加的列族 e...