日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

HBase Shell 基本操作

發(fā)布時間:2024/9/30 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 HBase Shell 基本操作 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

HBase Shell 操作

基本操作

  • 進入 HBase 客戶端命令行
bin/hbase shell
  • 查看幫助命令
help
  • 查看當前數(shù)據(jù)庫中有哪些表
list

表的操作

  • 創(chuàng)建表
create 'student','info'
  • 插入數(shù)據(jù)到表
put 'student','1001','info:sex','male' put 'student','1001','info:age','18' put 'student','1002','info:name','Janna' put 'student','1002','info:sex','female' put 'student','1002','info:age','20'
  • 掃描查看表數(shù)據(jù)
scan 'student'scan 'student',{STARTROW => '1001', STOPROW => '1001'}scan 'student',{STARTROW => '1001'}
  • 查看表結(jié)構(gòu)
describe 'student'
  • 更新指定字段的數(shù)據(jù)
put 'student','1001','info:name','Nick'put 'student','1001','info:age','100'
  • 查看“指定行”或“指定列族:列”的數(shù)據(jù)
get 'student','1001'get 'student','1001','info:name'
  • 統(tǒng)計表數(shù)據(jù)行數(shù)
count 'student'
  • 刪除數(shù)據(jù)

刪除某 rowkey 的全部數(shù)據(jù)

deleteall 'student','1001'

刪除某 rowkey 的某一列數(shù)據(jù)

delete 'student','1002','info:sex'
  • 清空表數(shù)據(jù)
truncate 'student'

提示:清空表的操作順序為先 disable,然后再 truncate。

  • 刪除表

首先需要先讓該表為 disable 狀態(tài)

disable 'student'

然后才能 drop 這個表

drop 'student'

提示:如果直接 drop 表,會報錯:ERROR: Table student is enabled. Disable it first.

  • 變更表信息

將 info 列族中的數(shù)據(jù)存放 3 個版本:

alter 'student',{NAME=>'info',VERSIONS=>3}get 'student','1001',{COLUMN=>'info:name',VERSIONS=>3}

總結(jié)

以上是生活随笔為你收集整理的HBase Shell 基本操作的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。