运行调试工具:
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.youkuaiyun.com/yueyedeai/article/details/17646929