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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

HBase表创建、删除、清空

發(fā)布時間:2023/12/31 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 HBase表创建、删除、清空 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

HBase shell窗口進入

執(zhí)行命令hbase shell

rowkey(行鍵)

product(列簇)

food(列簇)

 

name(列標(biāo)識符)

price(列標(biāo)識符)

name

price(列標(biāo)識符)

price(列標(biāo)識符)

rowkey001

ThinkPad E550
(cell基本單元格)

4199

orange

3166

6.0

version(版本)

5.0

5.5

6.0

?

?

HBase表的創(chuàng)建

# 語法:create <table>, {NAME => <family>, VERSIONS => <VERSIONS>}
# 例如:創(chuàng)建表t1,有兩個family name(列簇名字):f1,f2,且版本數(shù)前者為3,后者為1

hbase(main)> create 't1',{NAME => 'f1', VERSIONS => 3},{NAME => 'f2', VERSIONS => 1}

HBase表的刪除

  • disable表
  • drop表
  • hbase(main)> disable 't1'
    hbase(main)> drop 't1'

    HBase表的清空

    hbase(main)> truncate 't1'

    #-----------------------------------------------------------------------------------------------------

    例如可能會出現(xiàn)這樣的情況:

    ERROR: Table book is enabled. Disable it first.

    For usage try 'help "drop"'

    Took 0.0092 seconds ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

    hbase(main):009:0> disable 'book'
    Took 2.4668 seconds ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
    hbase(main):010:0> drop "book"

    也就是需要先disable然后才能drop

    #-----------------------------------------------------------------------------------------------------

    drop一個表格后,如果創(chuàng)建同名表格,會發(fā)現(xiàn)舊有的數(shù)據(jù)還在,這是怎么回事?

    完整刪除一個表格的步驟如下:

    hbase(main):035:0* disable "book"
    Took 4.3432 seconds ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
    hbase(main):036:0> alter 'book',{NAME=>'columnName', TTL => '1'}
    Updating all regions with the new schema...
    All regions updated.
    Done.
    Took 1.9354 seconds ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
    hbase(main):037:0> drop "book"
    Took 1.3067 seconds ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
    hbase(main):038:0>?
    hbase(main):039:0*?
    hbase(main):040:0*?
    hbase(main):041:0*?
    hbase(main):042:0* create "book","information"
    Created table book
    Took 4.3114 seconds ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
    => Hbase::Table - book
    hbase(main):043:0> scan "book"
    ROW ? ? ? ? ? ? ? ? ? ? ? ? ? COLUMN+CELL ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
    0 row(s)
    Took 0.0214 seconds ? ? ? ? ? ? ? ? ? ? ? ? ? ??

    ?

    ?

    轉(zhuǎn)載自:

    https://www.cnblogs.com/followees/p/8336071.html

    ?

    總結(jié)

    以上是生活随笔為你收集整理的HBase表创建、删除、清空的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

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