<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                參考文章:?[https://www.yiibai.com/hbase/](https://www.yiibai.com/hbase/) 結構描述: 表是行的集合。 行是列族的集合。 列族是列的集合。 列是鍵值對的集合。 1.特定的前綴或尾綴格式構成表名,可以成為命名空間,如 amz\_jp:tb\_seller 其中amz\_jp:可以當命名空間 2.Hbase的緯度 表 =>列族 =>列 =>值?\[列族是必須的,列不是必須的,列族是列的統一抽象\] 3.hbase shell 常用命令 status? 查看hbase服務器狀態 list? 列出所有的表 exists "table\_name"? 檢查某表是否存在 describe "table\_name"? 描述表結構 create "table\_name"?, "column\_family1" , "column\_family2"? ?創建某表 并確定列族 4.habse以row\_key作為主鍵存儲列信息? 其中row\_key具有字典序和自然序的特征排列存儲。所以設計時要考慮該特性將關聯數組構造成同結構row\_key的數據在一起 shell 命令參數 最好都用單引號 ?? shell 進入hbase shell console $HBASE\_HOME/bin/hbase shell 如果有kerberos認證,需要事先使用相應的keytab進行一下認證(使用kinit命令),認證成功之后再使用hbase shell進入可以使用whoami命令可查看當前用戶 hbase(main)> whoami 表的管理 1)查看有哪些表 hbase(main)> list 使用exists 命令驗證表是否被刪除。 hbase(main)> exists 'test' Table test does not exist 2)創建表 \# 語法:create , {NAME => , VERSIONS => } \# 例如:創建表t1,有兩個column family:f1,f2,且版本數均為2 hbase(main)> create 't1',{NAME => 'f1', VERSIONS => 2},{NAME => 'f2', VERSIONS => 2} 3)刪除表 分兩步:首先disable,然后drop 例如:刪除表t1 hbase(main)> disable 't1' hbase(main)> drop 't1' 4)查看表的結構 \# 語法:describe \# 例如:查看表t1的結構 hbase(main)> describe 't1' 5)修改表結構 修改表結構必須先disable 添加列族 \# 語法:alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'} \# 例如:修改表t1的cf的TTL為180天 hbase(main)> disable 't1' hbase(main)> alter 't1',{NAME=>'body',TTL=>'15552000'},{NAME=>'meta', TTL=>'15552000'} hbase(main)> alter 't1','body1','meta1' hbase(main)> enable 't1' 刪除列族 hbase> alter 'table name', 'delete' => 'column family'? 權限管理 1)分配權限 \# 語法 : grant 參數后面用逗號分隔 \# 權限用五個字母表示: "RWXCA". \# READ('R'), WRITE('W'), EXEC('X'), CREATE('C'), ADMIN('A') \# 例如,給用戶'luanpeng'分配對表t1有讀寫的權限, hbase(main)> grant 'luanpeng','RW','t1' 2)查看權限 \# 語法:user\_permission \# 例如,查看表t1的權限列表 hbase(main)> user\_permission 't1' 3)收回權限 \# 與分配權限類似,語法:revoke \# 例如,收回luanpeng用戶在表t1上的權限 hbase(main)> revoke 'luanpeng','t1' 表數據的增刪改查 1)添加數據 \# 語法:put ,,,, \# 例如:給表t1的添加一行記錄:rowkey是rowkey001,family name是f1,column name是col1,value是value01,timestamp:系統默認 hbase(main)> put 't1','rowkey001','f1:col1','value01' 用法比較單一。 2)查詢數據 a)查詢某行記錄 \# 語法:get ,,\[,....\] \# 例如:查詢表t1,rowkey001中的f1下的col1的值 hbase(main)> get 't1','rowkey001', 'f1:col1' \# 或者: hbase(main)> get 't1','rowkey001', {COLUMN=>'f1:col1'} \# 查詢表t1,rowke002中的f1下的所有列值 hbase(main)> get 't1','rowkey001' b)掃描表 \# 語法:scan , {COLUMNS => \[ ,.... \], LIMIT => num} \# 另外,還可以添加STARTROW、TIMERANGE和FITLER等高級功能 \# 例如:掃描表t1的前5條數據 hbase(main)> scan 't1',{LIMIT=>5} c)查詢表中的數據行數 \# 語法:count , {INTERVAL => intervalNum, CACHE => cacheNum} \# INTERVAL設置多少行顯示一次及對應的rowkey,默認1000;CACHE每次去取的緩存區大小,默認是10,調整該參數可提高查詢速度 \# 例如,查詢表t1中的行數,每100條顯示一次,緩存區為500 hbase(main)> count 't1', {INTERVAL => 100, CACHE => 500} 3)刪除數據 a )刪除行中的某個列值 \# 語法:delete , ,? , ,必須指定列名 \# 例如:刪除表t1,rowkey001中的f1:col1的數據 hbase(main)> delete 't1','rowkey001','f1:col1' 注:將刪除改行f1:col1列所有版本的數據 b )刪除行 \# 語法:deleteall , ,? , ,可以不指定列名,刪除整行數據 \# 例如:刪除表t1,rowk001的數據 hbase(main)> deleteall 't1','rowkey001' c)刪除表中的所有數據 \# 語法: truncate \# 其具體過程是:disable table -> drop table -> create table \# 例如:刪除表t1的所有數據 hbase(main)> truncate 't1' Region管理 1)移動region \# 語法:move 'encodeRegionName', 'ServerName' \# encodeRegionName指的regioName后面的編碼,ServerName指的是master-status的Region Servers列表 \# 示例 hbase(main)>move '4343995a58be8e5bbc739af1e91cd72d', 'db-41.xxx.xxx.org,60020,1390274516739' 2)開啟/關閉region \# 語法:balance\_switch true|false hbase(main)> balance\_switch 3)手動split \# 語法:split 'regionName', 'splitKey' 4)手動觸發major compaction #語法: #Compact all regions in a table: #hbase> major\_compact 't1' #Compact an entire region: #hbase> major\_compact 'r1' #Compact a single column family within a region: #hbase> major\_compact 'r1', 'c1' #Compact a single column family within a table: #hbase> major\_compact 't1', 'c1' 配置管理及節點重啟 1)修改hdfs配置 hdfs配置位置:/etc/hadoop/conf \# 同步hdfs配置 cat /home/hadoop/slaves|xargs -i -t scp /etc/hadoop/conf/hdfs-site.xml hadoop@{}:/etc/hadoop/conf/hdfs-site.xml #關閉: cat /home/hadoop/slaves|xargs -i -t ssh hadoop@{} "sudo /home/hadoop/cdh4/hadoop-2.0.0-cdh4.2.1/sbin/hadoop-daemon.sh --config /etc/hadoop/conf stop datanode" #啟動: cat /home/hadoop/slaves|xargs -i -t ssh hadoop@{} "sudo /home/hadoop/cdh4/hadoop-2.0.0-cdh4.2.1/sbin/hadoop-daemon.sh --config /etc/hadoop/conf start datanode" 1 2 3 4 5 6 2)修改hbase配置 hbase配置位置:/home/hadoop/hbase \# 同步hbase配置 cat /home/hadoop/hbase/conf/regionservers|xargs -i -t scp /home/hadoop/hbase/conf/hbase-site.xml hadoop@{}:/home/hadoop/hbase/conf/hbase-site.xml \# graceful重啟 cd ~/hbase bin/graceful\_stop.sh --restart --reload --debug inspurXXX.xxx.xxx.org hbase shell 腳本 編寫一個文本文件hbasedemo.txt: disable 'table1' drop 'table1' create 'table1', 'column\_family1','column\_family2'?? list 'table1'?? put 'table1', 'row\_key1', 'column\_family1:col1', 'value1'?? put 'table1', 'row\_key2', 'column\_family1:col2', 'value2'?? put 'table1', 'row\_key3', 'column\_family2:col3', 'value3'?? put 'table1', 'row\_key4', 'column\_family2:col4', 'value4'?? scan 'table1'?? scan 'table1',{LIMIT=>5} get 'table1', 'row\_key1'?? get 'table1','row\_key1', 'column\_family1:col1' count 'table1' disable 'table1'?? alter 'table1',NAME=>'column\_family3' alter 'table1','delete'=>'column\_family3' enable 'table1'? describe 'table1'? grant 'root','RW','table1' user\_permission 'table1' delete 'table1','row\_key1','column\_family1:col1' deleteall 'table1','row\_key1' truncate 'table1' 在HBase shell中運行這個腳本 hbase shell hbasedemo.txt
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看