hbck2的使用方法

 $  ${HBASE_HOME}/bin/hbase --config /etc/hbase-conf hbck -j ~/hbase-operator-tools/hbase-hbck2/target/hbase-hbck2-1.0.0-SNAPSHOT.jar
 
usage: HBCK2 [OPTIONS] COMMAND <ARGS>
Options:
 -d,--debug                                       run with debug output
 -h,--help                                        output this help message
 -p,--hbase.zookeeper.property.clientPort <arg>   port of hbase ensemble
 -q,--hbase.zookeeper.quorum <arg>                hbase ensemble
 -s,--skip                                        skip hbase version check
                                                  (PleaseHoldException)
 -v,--version                                     this hbck2 version
 -z,--zookeeper.znode.parent <arg>                parent znode of hbase ensemble                                                

reportMissingRegionsInMeta

使用方法

 reportMissingRegionsInMeta [<NAMESPACE|NAMESPACE:TABLENAME>...|
      -i <INPUT_FILE>...]
   Options:
    -i,--inputFiles  take one or more files of namespace or table names
  1. HBCK2 reportMissingRegionsInMeta default:table_1 default:table_2
  2. HBCK2 reportMissingRegionsInMeta default:table_1 ns1
  3. HBCK2 reportMissingRegionsInMeta -i fileName1 fileName2

addFsRegionsMissingInMeta

使用方法

addFsRegionsMissingInMeta [OPTIONS] [<NAMESPACE|NAMESPACE:TABLENAME>...|-i <INPUTFILES>...]
   Options:
    -i,--inputFiles  take one or more files of namespace or table names
    -o,--outputFile  name/prefix of the file(s) to dump region names
    -n,--numLines  number of lines to be written to each output file
  1. HBCK2 addFsRegionsMissingInMeta default:tbl_1 n1:tbl_2 n2

  2. HBCK2 addFsRegionsMissingInMeta -i fileName1 fileName2

  3. 如果指定-o选项,则该输出文件可以在后续assign命令的-i选项中直接当传入参数使用

assigns

使用方法

 assigns [OPTIONS] [<ENCODED_REGIONNAME>...|-i <INPUT_FILE>...]
   Options:
    -o,--override  override ownership by another procedure
    -i,--inputFiles  take one or more files of encoded region names
    -b,--batchSize   number of regions to process in a batch
  1. HBCK2 assigns 1588230740 de00010733901a05f5a2a3a382e27dd4
  2. HBCK2 assigns -i fileName1 fileName2
    如果指定-i或–inputFiles,可以传入一个文件。该文件包含region的编码名,一行一个
  3. HBCK2 assigns -i fileName1 fileName2 -b 500
    -b可以控制分配的批次数

unassigns

使用方法

unassigns [OPTIONS] [<ENCODED_REGIONNAME>...|-i <INPUT_FILE>...]
   Options:
    -o,--override  override ownership by another procedure
    -i,--inputFiles  take one or more input files of encoded region names
    -b,--batchSize   number of regions to process in a batch
  1. HBCK2 unassigns 1588230740 de00010733901a05f5a2a3a382e27dd4
  2. HBCK2 unassigns -i fileName1 fileName2
  3. HBCK2 unassigns -i fileName1 fileName2 -b 500

extraRegionsInMeta

使用方法

extraRegionsInMeta [<NAMESPACE|NAMESPACE:TABLENAME>...|
      -i <INPUT_FILE>...]
   Options:
    -f, --fix    fix meta by removing all extra regions found.
    -i,--inputFiles  take one or more input files of namespace or
   table names
  1. HBCK2 extraRegionsInMeta default:table_1 default:table_2 ns1
    default ns下的table_1和table_2、以及ns1下的所有表触发报告
  2. HBCK2 extraRegionsInMeta -i fileName1 fileName2

filesystem

使用方法

 filesystem [OPTIONS] [<TABLENAME>...|-i <INPUT_FILE>...]
   Options:
    -f, --fix    sideline corrupt hfiles, bad links, and references.
    -i,--inputFiles  take one or more input files of table names
  1. HBCK2 filesystem -i fileName1 fileName2
  2. HBCK2 filesystem test

fixMeta

setRegionState

  • 设置region状态修改成功则返回0,失败则返回1。

  • 典型场景:因为region在hbase:meta表中状态不一致,导致无法unassigns或者assigns。但比如 region只有在SPLITTING|SPLIT|MERGING|OPEN|CLOSING状态才可以unassigns。

  • 注意:
    1.该操作为高危操作,作为最后手段使用。
    2.在执行命令之前,确保regon没有其他正在运行procedure,如assign、split等。可以通过list_procedure命令查看

  • region的状态有OFFLINE, OPENING, OPEN, CLOSING, CLOSED, SPLITTING, SPLIT,
    FAILED_OPEN, FAILED_CLOSE, MERGING, MERGED, SPLITTING_NEW,
    MERGING_NEW, ABNORMALLY_CLOSED

使用方法

setRegionState [<ENCODED_REGIONNAME> <STATE>|-i <INPUT_FILE>...]
   Options:
    -i,--inputFiles  take one or more input files of encoded region names
   and states.
  1. HBCK2 setRegionState de00010733901a05f5a2a3a382e27dd4 CLOSING
  2. HBCK2 setRegionState -i fileName1 fileName2

setTableState

 setTableState [<TABLENAME> <STATE>|-i <INPUT_FILE>...]
   Options:
    -i,--inputFiles  take one or more files of table names and states
  1. HBCK2 setTableState users ENABLED
    回表之前的状态
  2. HBCK2 setTableState users ENABLED

bypass

使用方法

bypass [OPTIONS] [<PID>...|-i <INPUT_FILE>...]
   Options:
    -o,--override   override if procedure is running/stuck
    -r,--recursive  bypass parent and its children. SLOW! EXPENSIVE!
    -w,--lockWait   milliseconds to wait before giving up; default=1
    -i,--inputFiles  take one or more input files of PID's
    -b,--batchSize   number of procedures to process in a batch
  1. HBCK2 bypass 48
  2. HBCK2 bypass -i fileName1 fileName2

generateMissingTableDescriptorFile

使用方法

generateMissingTableDescriptorFile [OPTIONS] [<TABLENAME>...]

regionInfoMismatch

 regionInfoMismatch
   Options:
   -f,--fix Update hbase:meta with the corrections

replication

使用方法

replication [OPTIONS] [<TABLENAME>...|-i <INPUT_FILE>...]
   Options:
    -f, --fix    fix any replication issues found.
    -i,--inputFiles  take one or more input files of table names

scheduleRecoveries

使用方法

scheduleRecoveries [<SERVERNAME>...|-i <INPUT_FILE>...]
   Options:
    -i,--inputFiles  take one or more input files of server names
  1. HBCK2 scheduleRecoveries a.example.org,29100,1540348649479
  2. HBCK2 scheduleRecoveries -i fileName1 fileName2

recoverUnknown

  • 对于报告unknowregionserver执行ServerCrashProcedure。
  • 如果创建Procedure成功则返回pid,没有创建则返回-1。该命令存在2.2.7, 2.3.5,2.4.3,2.5.0或更新版本

发现问题

master logs

Master负责所有region的分配regionserver的崩溃处理集群启停。所有这些都是以Procedures的形式在状态机运行每个Procedure都有Procedure id,即pid通过pid可以在日志跟踪所有的过程
比如以下就是一个stuck procedure的例子

2018-09-12 15:29:06,558 WARN org.apache.hadoop.hbase.master.assignment.AssignmentManager: STUCK Region-In-Transition rit=OPENING, location=va1001.example.org,22101,1536173230599, table=IntegrationTestBigLinkedList_20180626110336, region=dbdb56242f17610c46ea044f7a42895b

Master UI

  1. Master UI: /masterstatus#tables
    可以通过ui观察表的状态
  2. Master UI: ‘Procedures &amp; Locks
    可以通过界面观察正在运行的Procedures和持有锁的情况、以及当前的Master Procedure WALs。
    如果发现集群中有卡住的Procedures和锁,或者WALs一直增长,则需要注意。
$ echo "list_locks"| hbase shell &amp;> /tmp/locks.txt
$ echo "list_procedures"| hbase shell &amp;> /tmp/procedures.txt
  1. Master UI: The ‘HBCK Report
    该界面会展示两个master两个进程定时检查结果
    CatalogJanitor:检查hbase:meta表是否存在overlaps或holes
    HBCK Chore:比对hbase:meta表与hdfs的目录文件

其他方式

  1. HBase Canary Tool
    可以用来测试region的状态
  2. 通过scan hbase:meta表来查看region的状态

原文地址:https://blog.csdn.net/zincooo/article/details/134694915

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_24216.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注