1. 程式人生 > 實用技巧 >大資料 HBase Shell

大資料 HBase Shell

# 禁用表
disable 'table_name'
# 刪除表
drop 'table_name'
# 查看錶是否存在
exit 'table_name'
# 禁用符合條件的表
disable_all 'tab.*'
# 刪除符合條件的表
drop_all 'tab.*'
# 建立表
create '表名', {NAME=>'列族1', 屬性名=>值}, {NAME=>'列族2'}
# 新增列族
alter 'test', 'cf2'
# 修改列族屬性
alter 'test',{NAME=>'cf', VERSIONS=>5}
alter '表名', 屬性名=>值, 屬性名=>值
alter '表名', NAME=>'列族', 屬性名=>值, 屬性名=>值
alter '表名', {NAME=>'列族', 屬性名=>值, 屬性名=>值},{NAME=>'列族', 屬性名=>值, 屬性名=>值}
alter '表名', 'delete' => '列族'
# 檢視符合條件的表
list ['萬用字元']
# 查看錶屬性
describe '表名'
# 啟動表
enable '表明'
# 新增資料
put 'test','row1','cf:name','iFan'
# 查詢
get 'test','row1',{COLUMN=>'cf:name', VERSIONS=>3}
scan 'test',{STARTROW=>'row3', ENDROW=>'row4'}
scan 'test',{RAW=>true, VERSION>5} // 查詢表未經過過濾的原始記錄
scan '表名', {LIMIT=>行數量}
# 刪除
delete 'test','row4','cf:name'
deleteall 'test','row5'
# 列出所有過濾器
show_filters