運作調試工具:
1、Canary
檢測HBase系統狀态的工具,檢測粒度可以是列族、Region或Region Server等
hbase org.apache.hadoop.hbase.tool.Canary
hbase org.apache.hadoop.hbase.tool.Canary <tablename>
...
2、hbck
用于檢查HBase叢集一緻性
傳回OK,說明保持一緻。如果報出INCONSISTENCY,說明處于不一緻狀态,需要解決問題,此時可以通過-details來檢視更多的細節
hbck
hbck <tablename>
分析工具:
1、計算hbase記錄數
$HBASE_HOME/bin/hbase org.apache.hadoop.hbase.mapreduce.RowCounter 'tablename'
2、收集和表相關的更細節的統計資料
hbase org.apache.hadoop.hbase.mapreduce.RowCounter <tablename>
資料遷移工具:
1、導出表資料(HDFS上)
Export 用來将表中的内容轉儲到HDFS上面的序列檔案,可指定時間戳 sudo -u hbase hbase org.apache.hadoop.hbase.mapreduce.Export <tablename> <outputdir>
2、導入表資料
sudo -u hbase hbase org.apache.hadoop.hbase.mapreduce.Import <tablename> <inputdir>
Import 工具用來将之前被 Export 的資料載入HBase中
3、表拷貝工具
hbase org.apache.hadoop.hbase.mapreduce.CopyTable -Dhbase.client.scanner.caching=100 -Dmapred.map.tasks.speculative.execution=false --startrow=rk1 --stoprow=rk4 --starttime=1265875194289 --endtime=1265878794289 --peer.adr=transwarp-perf1,transwarp-perf2,transwarp-perf3:2181:/hyperbase1 --new.name=TestTableNew --families=cf1:cf2 TestTable 該指令中各選項的含義如下: startrow:起始行; stoprow:結束行; starttime:起始時間(毫秒級unixtime),如果沒有設定結束時間意味着永遠執行; endtime:結束時間,若沒有明确指定起始時間,可忽略該選項; new.name:新的表名; peer.adr:目标對等叢集位址(實為Zookeeper位址),采用如下格式: 【hbase.zookeeper.quorum:hbase.zookeeper.client.port:zookeeper.znode.parent;】 families:需拷貝的列族清單,如有多個用逗号分隔。此處cf1:cf2表示從cf1拷貝到cf2。
4、生成HFile檔案導入Hbase中
https://www.cnblogs.com/admln/p/5390333.html
建立hbase表,生産表需要分區
create 'testImport2','cf'
生成Hfile
hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.separator="," -Dimporttsv.bulk.output=/tmp/zyl5 -Dimporttsv.columns=HBASE_ROW_KEY,cf:name testImport2 /tmp/sample1.csv
将Hfile導入到hbase表中
hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles /tmp/zyl5 testImport2
參考文獻:
https://blog.csdn.net/yueyedeai/article/details/17646929
https://www.jianshu.com/p/f9230cc27cc6