• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

HBase集群修复工具HBCK2

武飞扬头像
小中.
帮助1

Apache HBase HBCK2 工具

HBCK2是 Apache HBase 集群的修复工具。

一. Region信息一致性

一致性是指Region在meta表的信息、Regionserver服务的Region信息和hdfs的Regioninfo的Region信息的一致。

学新通

二. HBCK2与hbck1

HBCK2继承自 hbck1,hbck1是 hbase -1.0版本开始附带的修复工具。hbck1不建议运行在 hbase-2.0版本以上的集群 ,它可能会造成一些严重的问题,需使用HBCK2代替 hbck1对 hbase-2.0以上集群进行修复。虽然hbck1仍然捆绑在 hbase-2.0以上的集群中 ,为了尽量减少意外hbck1已被弃用,将在hbase-3.0中删除。hbck1的修复功能 ( -fix) 已被删除,但可以报告 hbase-2.x 集群的状态;hbck1不了解 hbase-2.x 集群内部工作原理,评估的不是很准确。因此,如果你正在使用HBase2.x,那么对HBCK2应该需要了解一些,即使不经常用到。

HBCK2不像以前的hbck1那样工作,即使在两个版本中命令名称相似的情况下也是如此。先来看一下hbck1的命令,我这里是hbase版本是2.4.11hbase hbck -h显示的是:

-----------------------------------------------------------------------
NOTE: As of HBase version 2.0, the hbck tool is significantly changed.
In general, all Read-Only options are supported and can be be used
safely. Most -fix/ -repair options are NOT supported. Please see usage
below for details on which options are not supported.
-----------------------------------------------------------------------

注意:从HBase 2.0版本开始,hbck工具有了较大的改变。一般来说,所有只读的操作都是支持的,并且使用是安全的。很多-fix/ -repair操作不在支持,使用可能会造成一些严重的问题。请参阅下面详细的使用说明不支持哪些选项。

NOTE: Following options are NOT supported as of HBase version 2.0 .

  UNSUPPORTED Metadata Repair options: (expert features, use with caution!)
   -fix              Try to fix region assignments.  This is for backwards compatiblity
   -fixAssignments   Try to fix region assignments.  Replaces the old -fix
   -fixMeta          Try to fix meta problems.  This assumes HDFS region info is good.
   -fixHdfsHoles     Try to fix region holes in hdfs.
   -fixHdfsOrphans   Try to fix region dirs with no .regioninfo file in hdfs
   -fixTableOrphans  Try to fix table dirs with no .tableinfo file in hdfs (online mode only)
   -fixHdfsOverlaps  Try to fix region overlaps in hdfs.
   -maxMerge <n>     When fixing region overlaps, allow at most <n> regions to merge. (n=5 by default)
   -sidelineBigOverlaps  When fixing region overlaps, allow to sideline big overlaps
   -maxOverlapsToSideline <n>  When fixing region overlaps, allow at most <n> regions to sideline per group. (n=2 by default)
   -fixSplitParents  Try to force offline split parents to be online.
   -removeParents    Try to offline and sideline lingering parents and keep daughter regions.
   -fixEmptyMetaCells  Try to fix hbase:meta entries not referencing any region (empty REGIONINFO_QUALIFIER rows)

  UNSUPPORTED Metadata Repair shortcuts
   -repair           Shortcut for -fixAssignments -fixMeta -fixHdfsHoles -fixHdfsOrphans -fixHdfsOverlaps -fixVersionFile -sidelineBigOverlaps -fixReferenceFiles-fixHFileLinks
   -repairHoles      Shortcut for -fixAssignments -fixMeta -fixHdfsHoles

在hbase2中,hbck的命令是不支持修复的,需要使用hbck2命令,后面会介绍。

三. Hbck1 一致性的检查和修复命令

一致性检查命令

hbase hbck <-details> <表名>
hbase hbck -details portrait:test1

一致性修复

hbase hbck <-fixMeta> ,<-fixAssignments> <表名>

命令详解

-fixMeta:Try to fix meta problems.  This assumes HDFS region info is good.

主要以hdfs为准进行修复,hdfs存在则添加到meta中,不存在删除meta对应region。

-fixAssignments:Try to fix region assignments.  Replaces the old -fix

不同情况,动作不一样,包括下线、关闭和重新上线

四. 构建和运行Hbck2

HBCK2每次运行时都会执行一个独立的任务,但并不影响HBCK2分析正在运行的集群,然后像hbck1那样修复所有问题。

HBCK2是用来修复的正在运行的集群中的不一致或堵塞Region。可以查看正在运行的集群 Master 的日志和Web UI,一旦发现问题就可以使用HBCK2工具进行修复或跳过不良状态。必须在HBase Master节点上进行修复,而不是在修复工具的本地进行修复,这是HBCK2和hbck1的另一个重要区别。
学新通

1. 获取HBCK2

HBCK2已经被剥离出HBase成为了一个单独的项目,如果你想要使用这个工具,需要根据自己HBase的版本,编译源码。

其GitHub地址为:https://github.com/apache/hbase-operator-tools.git

hbase-operator-tools/pom.xml中将hbase版本换成当前HBase版本,项目根目录下运行打包命令:

mvn clean install -DskipTests

打包完成后,是有多个jar包的,将自己需要的hbck2取出来hbase-operator-tools/hbase-hbck2/target/hbase-hbck2-1.0.0-SNAPSHOT.jar

2. 运行Hback2

hbase-hbck2-1.3.0-SNAPSHOT.jar不是胖jar,运行时需要提供依赖;向HBCK2提供其依赖的最简单方法是通过$HBASE_HOME/bin/hbase脚本来启动HBCK2。hbase脚本本身就提供了hbck操作,默认情况下试运行的hbck1工具;运行hbck2 需要指定jar包路径-j /path/to/HBCK2.jar。可以使用的hbase -h查看帮助文档。

${HBASE_HOME}/bin/hbase --config /etc/hbase-conf hbck -j ~/hbase-operator-tools/hbase-hbck2/target/hbase-hbck2-1.0.0-SNAPSHOT.jar

hbase --config /usr/hbase-2.4.11/conf hbck -j /root/zhongyk/hbase-hbck2-1.3.0-SNAPSHOT.jar

/etc/hbase-conf是hbase部署的配置所在目录。HBCK2的jar在~/hbase-operator-tools/hbase-hbck2/target/hbase-hbck2-1.0.0-SNAPSHOT.jar。上述命令没有传递任何选项或参数将输出HBCK2命令的帮助文档:

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
 ......

五.HBCK2概述

HBCK2目前是一个简单的工具,一次只做一件事。

在hbase-2.x中,Master是所有状态的最终决定者,所以大多数HBCK2命令原则是要求Master实现对hbase进行修复。这意味着在你运行HBCK2命令之前,Master必须已经启动。

HBCK2的实现方法是利用Master的HbckService服务,该服务发布了一些方法供HBCK2工具使用。因此,HBCK2依赖Master的HbckService服务,HBCK2做的第一件事是探查集群以确保服务是可用的。如果HbckService服务没有启动或者缺乏所需的方法,这将会失败。

HBCK2应该能够跨多个hbase-2.x版本工作。如果它无法运行,就会输出异常信息。在2.0.3至2.1.1的hbase版本中没有HbckService,HBCK2不能在这些版本中运行。对于这种种情况,如果你可以请更新你的集群以获得更多的修复工具。

命令使用示例:

#cd /usr/hbase-2.4.11/bin
# 运行Hback2
hbase --config /usr/hbase-2.4.11/conf hbck -j /root/zhongyk/hbase-hbck2-1.3.0-SNAPSHOT.jar
# 当hbase:meta中缺少region,但目录仍然存在于HDFS中时使用,报告meta中缺少region
hbase --config  /usr/hbase-2.4.11/conf hbck -j ~/zhongyk/hbase-hbck2-1.3.0-SNAPSHOT.jar reportMissingRegionsInMeta portrait:user_portrait
#当hbase:meta中缺少region,但目录仍然存在于HDFS中时使用,重新将有效region的添加到meta中。
hbase --config  /usr/hbase-2.4.11/conf hbck -j ~/zhongyk/hbase-hbck2-1.3.0-SNAPSHOT.jar addFsRegionsMissingInMeta portrait:user_portrait
# 当hbase:meta上存在的区域,但HDFS没有相关的目录时使用。-f 通过删除所有发现的额外区域来修复元数据。
hbase --config  /usr/hbase-2.4.11/conf hbck -j ~/zhongyk/hbase-hbck2-1.3.0-SNAPSHOT.jar extraRegionsInMeta -f portrait:user_portrait
# 修Region的状态
hbase --config  /usr/hbase-2.4.11/conf hbck -j ~/zhongyk/hbase-hbck2-1.3.0-SNAPSHOT.jar setRegionState 7b54c3ba927f4a5dbca62464d7893958 OPEN

更多操作可参考:https://blog.csdn.net/wolf_333/article/details/118854634

翻译笔记(后续整理):

usage: HBCK2 [OPTIONS] COMMAND <ARGS>
Options:
  -d,--debug                                       run with debug output
 												  												debug方式运行
 -h,--help                                        output this help message
 												  												查看帮助文档
 -p,--hbase.zookeeper.property.clientPort <arg>   port of hbase ensemble
 												  												hbase集群端口
 -q,--hbase.zookeeper.quorum <arg>                hbase ensemble
												  												hbase的IP或主机名
 -s,--skip                                        skip hbase version check
                                                  (PleaseHoldException)
                                                  跳过hbase版本检查
 -v,--version                                     this hbck2 version
                                                  查看hbck2的版本
 -z,--zookeeper.znode.parent <arg>                parent znode of hbase
                                                  ensemble
Command:
 addFsRegionsMissingInMeta <NAMESPACE|NAMESPACE:TABLENAME>...|-i <INPUT_FILE>...
   Options:
    -i,--inputFiles  take one or more files of namespace or table names
    接收一个或多个表名空间的输入文件 
   当hbase:meta缺少regions,但HDFS目录仍然存在regions的数据。
   如果用户运行hbck1对hbase-2.x的集群会发生'OfflineMetaRepair'。
   需要hbase:meta在线。为每一个表名作为参数传递,执行可用的regions修复hbase:meta和HDFS region目录的差异。
   
   To be used when regions missing from hbase:meta but directories
   are present still in HDFS. Can happen if user has run _hbck1_
   'OfflineMetaRepair' against an hbase-2.x cluster. Needs hbase:meta
   to be online. For each table name passed as parameter, performs diff
   between regions available in hbase:meta and region dirs on HDFS.
   Then for dirs with no hbase:meta matches, it reads the 'regioninfo'
   metadata file and re-creates given region in hbase:meta. Regions are
   re-created in 'CLOSED' state in the hbase:meta table, but not in the
   Masters' cache, and they are not assigned either. To get these
   regions online, run the HBCK2 'assigns'command printed when this
   command-run completes.
   当hbase:meta中缺少区域,但目录仍在HDFS中时,可以使用。但在HDFS中仍然存在。如果用户对hbase-2.x运行了_hbck1_ 'OfflineMetaRepair'对hbase-2.x集群。需要hbase:meta 是在线的。对于每一个作为参数传递的表名,在hbase:meta中可用的区域之间执行差异 中的区域和 HDFS 上的区域目录之间的差异。然后对于没有hbase:meta匹配的目录,它读取'regioninfo'的 元数据文件并在hbase:meta中重新创建指定的区域。区域被 重新创建的区域在hbase:meta表中处于 "关闭 "状态,但不在master缓存中。Master'缓存中,而且它们也没有被分配。为了让这些 区域,在这个命令运行完成后,运行HBCK2的'assigns'命令。命令运行完成后打印出来。
   NOTE: If using hbase releases older than 2.3.0, a rolling restart of
   HMasters is needed prior to executing the set of 'assigns' output.
   An example adding missing regions for tables 'tbl_1' in the default
   namespace, 'tbl_2' in namespace 'n1' and for all tables from
   namespace 'n2':
   注意:如果使用比2.3.0更早的hbase版本,在执行'assigns'输出之前,需要滚动重启HMasters 在执行这组'assigns'输出之前,需要滚动重启HMasters。一个例子:为默认命名空间中的表'tbl_1'添加缺失区域,命名空间'n1'中的'tbl_2'以及命名空间'n2'中的所有表。
   
     $ HBCK2 addFsRegionsMissingInMeta default:tbl_1 n1:tbl_2 n2
    
   Returns HBCK2  an 'assigns' command with all re-inserted regions.
   If -i or --inputFiles is specified, pass one or more input file names.
   Each file contains <NAMESPACE|NAMESPACE:TABLENAME>, one per line. For example:
   返回HBCK2的'assigns'命令,包括所有重新插入的区域。如果指定了-i或-inputFiles,传递一个或多个输入文件名。每个文件包含<NAMESPACE|NAMESPACE:TABLENAME>,每行一个。例如。
    For example:
     $ HBCK2 addFsRegionsMissingInMeta -i fileName1 fileName2
   SEE ALSO: reportMissingRegionsInMeta
   另见
   SEE ALSO: fixMeta
   另见

 assigns [OPTIONS] <ENCODED_REGIONNAME/INPUTFILES_FOR_REGIONNAMES>...
   Options:
    -o,--override  override ownership by another procedure
    								覆盖
    -i,--inputFiles  take one or more encoded region names
   A 'raw' assign that can be used even during Master initialization (if
   the -skip flag is specified). Skirts Coprocessors. Pass one or more
   encoded region names. 1588230740 is the hard-coded name for the
   hbase:meta region and de00010733901a05f5a2a3a382e27dd4 is an example of
   what a user-space encoded region name looks like. For example:
   取一个或多个编码的区域名称 一个 "原始 "赋值,即使在Master初始化过程中也可以使用(如果指定了 指定了-skip标志)。裙边协处理器。传递一个或多个 编码的区域名称。1588230740是硬编码的名称,用于 hbase:meta区域的硬编码名称,de00010733901a05f5a2a3a382e27dd4是一个用户空间编码区域名称的例子。用户空间编码的区域名称是什么样子的。比如说
     $ HBCK2 assigns 1588230740 de00010733901a05f5a2a3a382e27dd4
   Returns the pid(s) of the created AssignProcedure(s) or -1 if none.
   返回创建的AssignProcedure的pid,如果没有则返回-1。
   If -i or --inputFiles is specified, pass one or more input file names.
   如果指定了-i或-inputFiles,传递一个或多个输入文件名。
   Each file contains encoded region names, one per line. For example:
   每个文件包含编码的区域名称,每行一个。比如说。
     $ HBCK2 assigns -i fileName1 fileName2

 bypass [OPTIONS] <PID>...
   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
    在放弃之前等待的毫秒数;默认=1
    -i,--inputFiles  take one or more input files of PIDs
   Pass one (or more) procedure 'pid's to skip to procedure finish. Parent
   of bypassed procedure will also be skipped to the finish. Entities will
   be left in an inconsistent state and will require manual fixup. May
   need Master restart to clear locks still held. Bypass fails if
   procedure has children. Add 'recursive' if all you have is a parent pid
   to finish parent and children. This is SLOW, and dangerous so use
   selectively. Does not always work.
   接受一个或多个PID的输入文件 传递一个(或多个)程序'pid',以跳过程序完成。父程序 的父程序也将被跳过到程序结束。实体将 处于不一致的状态,需要手动修复。可能 需要主程序重启以清除仍然持有的锁。旁路失败,如果 程序有子程序。如果你只有一个父程序的pid,请添加 "递归"。来完成父程序和子程序。这很慢,而且很危险,所以要 选择性地使用。并不总是有效。
   If -i or --inputFiles is specified, pass one or more input file names.
   Each file contains PID's, one per line. For example:
   如果指定了-i或-inputFiles,传递一个或多个输入文件名。
   每个文件包含PID,每行一个。比如说。
     $ HBCK2 bypass -i fileName1 fileName2

 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
     接收一个或多个输入文件,
   Reports regions present on hbase:meta, but with no related
   directories on the file system. Needs hbase:meta to be online.
   For each table name passed as parameter, performs diff
   between regions available in hbase:meta and region dirs on the given
   file system. Extra regions would get deleted from Meta
   if passed the --fix option.
  
   这些文件包括hbase:meta上的命名空间或表名报告区域,但在文件系统中没有相关的目录。需要hbase:meta在线。或者每个表名作为参数传递,在hbase:meta中的区域和给定的区域目录之间进行差分。在hbase:meta中可用的区域和给定文件系统中的区域目录之间进行差异。文件系统上的区域。额外的区域将被从Meta中删除 中删除,如果通过-fix选项的话。
   
   报告在hbase:meta上存在的区域,但在文件系统中没有相关的目录。需要hbase:meta在线。或者每一个作为参数传递的表名,在hbase:meta中的区域和给定的区域目录之间进行diff 在hbase:meta中的区域和给定文件系统中的区域目录之间进行差异。文件系统中的区域。额外的区域将被从Meta中删除 中删除,如果通过-fix选项的话。
   NOTE: Before deciding on use the "--fix" option, it's worth check if
   reported extra regions are overlapping with existing valid regions.
   If so, then "extraRegionsInMeta --fix" is indeed the optimal solution.
   Otherwise, "assigns" command is the simpler solution, as it recreates
   regions dirs in the filesystem, if not existing.
   注意:在决定使用"-fix "选项之前,值得检查一下报告的额外区域是否与现有的有效区域重叠。如果是,那么 "extraRegionsInMeta --fix "确实是最佳解决方案。否则,"assigns "命令是更简单的解决方案,因为它在文件系统中重新创建了 如果不存在,它将在文件系统中重新创建区域目录。
   An example triggering extra regions report for tables 'table_1'
   and 'table_2', under default namespace:
   一个在默认命名空间下触发表 "table_1 "和 "table_2 "的额外区域报告的例子。
     $ HBCK2 extraRegionsInMeta default:table_1 default:table_2
   An example triggering extra regions report for table 'table_1'
   under default namespace, and for all tables from namespace 'ns1':
   触发表 "table_1 "的额外区域报告的一个例子 和来自命名空间'ns1'的所有表。
     $ HBCK2 extraRegionsInMeta default:table_1 ns1
   Returns list of extra regions for each table passed as parameter, or
   for each table on namespaces specified as parameter.
   返回作为参数传递的每个表的额外区域列表,或者作为参数指定的命名空间上的每个表
   If -i or --inputFiles is specified, pass one or more input file names.
   Each file contains <NAMESPACE|NAMESPACE:TABLENAME>, one per line. For example:
   如果指定了-i或-inputFiles,传递一个或多个输入文件名。每个文件包含<NAMESPACE|NAMESPACE:TABLENAME>,每行一个。比如说。
     $ HBCK2 extraRegionsInMeta -i fileName1 fileName2

 filesystem [OPTIONS] [<TABLENAME>...|-i <INPUT_FILE>...]
   Options:
    -f, --fix    sideline corrupt hfiles, bad links, and references.
    			副线腐败的hfiles,坏的链接,和参考资料。
    -i,--inputFiles  take one or more input files of table names
   Report on corrupt hfiles, references, broken links, and integrity.
   Pass '--fix' to sideline corrupt files and links. '--fix' does NOT
   fix integrity issues; i.e. 'holes' or 'orphan' regions. Pass one or
   more tablenames to narrow checkup. Default checks all tables and
   restores 'hbase.version' if missing. Interacts with the filesystem
   only! Modified regions need to be reopened to pick-up changes.
   取一个或多个表名的输入文件 报告损坏的hfiles、引用、断裂的链接和完整性。通过'--fix'来排查损坏的文件和链接。--fix "并不 修复完整性问题;即 "洞 "或 "孤儿 "区域。通过一个或多个 多个tablenames来缩小检查范围。默认检查所有的表并 如果缺失,则恢复 "hbase.version"。与文件系统交互 仅仅是! 修改过的区域需要重新打开以获取变化。
   If -i or --inputFiles is specified, pass one or more input file names.
   Each file contains <TABLENAME>, one per line. For example:
   如果指定了-i或-inputFiles,传递一个或多个输入文件名。每个文件包含<TABLENAME>,每行一个。比如说。
     $ HBCK2 extraRegionsInMeta -i fileName1 fileName2

 fixMeta
   Do a server-side fix of bad or inconsistent state in hbase:meta.
   Available in hbase 2.2.1/2.1.6 or newer versions. Master UI has
   matching, new 'HBCK Report' tab that dumps reports generated by
   most recent run of _catalogjanitor_ and a new 'HBCK Chore'. It
   is critical that hbase:meta first be made healthy before making
   any other repairs. Fixes 'holes', 'overlaps', etc., creating
   (empty) region directories in HDFS to match regions added to
   hbase:meta. Command is NOT the same as the old _hbck1_ command
   named similarily. Works against the reports generated by the last
   catalog_janitor and hbck chore runs. If nothing to fix, run is a
   noop. Otherwise, if 'HBCK Report' UI reports problems, a run of
   fixMeta will clear up hbase:meta issues. See 'HBase HBCK' UI
   for how to generate new report.
   对hbase:meta中的不良或不一致的状态做一个服务器端的修复。在hbase 2.2.1/2.1.6或更新的版本中可用。主界面有 匹配,新的 "HBCK报告 "选项卡可以转储由_catalogjanitor最近一次运行产生的报告。新的 "HBCK报告 "选项卡,它可以转储由_catalogjanitor_最近一次运行产生的报告和新的 "HBCK任务"。这一点 在进行任何其他修复之前,首先要使hbase:meta变得健康,这是至关重要的。任何其他的修复。修复了 "漏洞"、"重叠 "等问题,在HBCK中创建了 (空的)区域目录,以匹配添加到HDFS中的区域。hbase:meta。该命令与以前的_hbck1_命令不一样。名称相似。对上一个_hbck1_命令所产生的报告起作用。catalog_janitor 和 hbck chore 运行产生的报告。如果没有什么可修复的,运行是一个 noop。否则,如果 "HBCK报告 "的用户界面报告了问题,运行一次 fixMeta将清除hbase:meta问题。参见 "HBase HBCK "用户界面 以了解如何生成新的报告。
   SEE ALSO: reportMissingRegionsInMeta

 generateMissingTableDescriptorFile <TABLENAME>
   Trying to fix an orphan table by generating a missing table descriptor
   file. This command will have no effect if the table folder is missing
   or if the .tableinfo is present (we don't override existing table
   descriptors). This command will first check it the TableDescriptor is
   cached in HBase Master in which case it will recover the .tableinfo
   accordingly. If TableDescriptor is not cached in master then it will
   create a default .tableinfo file with the following items:
   试图通过生成一个丢失的表描述符来修复一个无主表 文件。如果表文件夹丢失,或者.tableinfo存在,这个命令就没有效果。或.tableinfo是存在的(我们不会覆盖现有的表 描述符)。该命令将首先检查TableDescriptor是否被 缓存在HBase Master中,在这种情况下,它将恢复.tableinfo 相应地恢复。如果TableDescriptor没有被缓存在主数据库中,那么它将会 创建一个默认的.tableinfo文件,其中包括以下项目:
     - the table name
     表的名称
     - the column family list determined based on the file system
     基于文件系统确定的列族列表
     - the default properties for both TableDescriptor and
       ColumnFamilyDescriptors
       表描述符和列族描述符的默认属性。列家族描述符的默认属性
   If the .tableinfo file was generated using default parameters then
   make sure you check the table / column family properties later (and
   change them if needed).
   如果.tableinfo文件是使用默认参数生成的,那么请确保你以后检查表/列族属性(并且 如果需要的话,可以改变它们)
   This method does not change anything in HBase, only writes the new
   .tableinfo file to the file system. Orphan tables can cause e.g.
   ServerCrashProcedures to stuck, you might need to fix these still
   after you generated the missing table info files.
   这个方法不会改变HBase中的任何东西,只是将新的  .tableinfo文件到文件系统。孤儿表可能会导致例如 孤岛表可能会导致例如ServerCrashProcedures卡住,你可能还需要在生成了缺失的表信息文件后修复这些表。在你生成了缺失的表信息文件之后,你可能还需要解决这些问题。
   

 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
   Looks for undeleted replication queues and deletes them if passed the
   '--fix' option. Pass a table name to check for replication barrier and
   purge if '--fix'.
   接受一个或多个表名的输入文件 寻找未删除的复制队列,如果通过'-fix'选项,则删除它们。'-fix'选项,则删除它们。传递一个表名来检查复制障碍并 清除,如果'-fix'的话
   If -i or --inputFiles is specified, pass one or more input file names.
   Each file contains <TABLENAME>, one per line. For example:
   如果指定了-i或-inputFiles,传递一个或多个输入文件名。每个文件包含<TABLENAME>,每行一个。比如说。
     $ HBCK2 replication -i fileName1 fileName2

 reportMissingRegionsInMeta <NAMESPACE|NAMESPACE:TABLENAME>...|-i <INPUT_FILE>...
   Options:
    -i,--inputFiles  take one or more input files of namespace or table names
     接受一个或多个名称空间或表名的输入文件
   To be used when regions missing from hbase:meta but directories
   are present still in HDFS. Can happen if user has run _hbck1_
   'OfflineMetaRepair' against an hbase-2.x cluster. This is a CHECK only
   method, designed for reporting purposes and doesn't perform any
   fixes, providing a view of which regions (if any) would get re-added
   to hbase:meta, grouped by respective table/namespace. To effectively
   re-add regions in meta, run addFsRegionsMissingInMeta.
   用于hbase:meta中缺少的区域,但目录仍在HDFS中。但仍存在于HDFS中。如果用户对hbase-2.x运行了_hbck1_ 'OfflineMetaRepair'对hbase-2.x集群。这是一个仅有的CHECK 方法,为报告目的而设计,不执行任何 修复,提供一个视图,显示哪些区域(如果有的话)会被重新添加到 到hbase:meta中,按照各自的表/命名空间分组。为了有效地 重新添加区域到meta中,运行addFsRegionsMissingInMeta。
   This command needs hbase:meta to be online. For each namespace/table
   passed as parameter, it performs a diff between regions available in
   hbase:meta against existing regions dirs on HDFS. Region dirs with no
   matches are printed grouped under its related table name. Tables with
   no missing regions will show a 'no missing regions' message. If no
   namespace or table is specified, it will verify all existing regions.
   It accepts a combination of multiple namespace and tables. Table names
   should include the namespace portion, even for tables in the default
   namespace, otherwise it will assume as a namespace value.
   这个命令需要hbase:meta是在线的。对于每个作为参数传递的命名空间/表 的参数,它都会在hbase:meta中的区域与HDFS上现有的区域目录之间进行比较。hbase:meta中的区域与HDFS上现有的区域目录进行比较。没有匹配的区域目录 匹配的区域目录会被打印出来,归入其相关的表名下。有 的表会显示一个 "没有丢失的区域 "的信息。如果没有 名称空间或表被指定,它将验证所有现有的区域。它接受多个命名空间和表的组合。表的名称 应该包括命名空间部分,即使是默认的 名称空间的表,否则它将假定为一个名称空间值。
   An example triggering missing regions report for tables 'table_1'
   and 'table_2', under default namespace:
   触发表'table_1'和'table_2'的缺失区域报告的例子,在默认命名空间下。
     $ HBCK2 reportMissingRegionsInMeta default:table_1 default:table_2
   An example triggering missing regions report for table 'table_1'
   under default namespace, and for all tables from namespace 'ns1':
    触发表 "table_1 "的缺失区域报告的一个例子 和来自命名空间'ns1'的所有表。
     $ HBCK2 reportMissingRegionsInMeta default:table_1 ns1
   Returns list of missing regions for each table passed as parameter, or
   for each table on namespaces specified as parameter.
    返回作为参数传递的每个表的缺失区域的列表,或 对于作为参数指定的命名空间上的每个表。
   If -i or --inputFiles is specified, pass one or more input file names.
   Each file contains <NAMESPACE|NAMESPACE:TABLENAME>, one per line. For example:
   如果指定了-i或-inputFiles,传递一个或多个输入文件名。每个文件包含<NAMESPACE|NAMESPACE:TABLENAME>,每行一个。比如说。
     $ HBCK2 reportMissingRegionsInMeta -i fileName1 fileName2

 setRegionState [<ENCODED_REGIONNAME> <STATE>|-i <INPUT_FILE>...]
    Options:
     -i,--inputFiles  take one or more input files of encoded region names and states
     接受一个或多个编码区域名称和状态的输入文件
  Possible region states:
    可能的区域状态
    OFFLINE, OPENING, OPEN, CLOSING, CLOSED, SPLITTING, SPLIT,
    FAILED_OPEN, FAILED_CLOSE, MERGING, MERGED, SPLITTING_NEW,
    MERGING_NEW, ABNORMALLY_CLOSED
   WARNING: This is a very risky option intended for use as last resort.
   Example scenarios include unassigns/assigns that can't move forward
   because region is in an inconsistent state in 'hbase:meta'. For
   example, the 'unassigns' command can only proceed if passed a region
   in one of the following states: SPLITTING|SPLIT|MERGING|OPEN|CLOSING
   Before manually setting a region state with this command, please
   certify that this region is not being handled by a running procedure,
   such as 'assign' or 'split'. You can get a view of running procedures
   in the hbase shell using the 'list_procedures' command. An example
   setting region 'de00010733901a05f5a2a3a382e27dd4' to CLOSING:
    这是一个非常有风险的选项,旨在作为最后手段使用。例子包括取消分配/分配不能前进 因为区域在'hbase:meta'中处于不一致的状态。例如 例如,'unassigns'命令只有在通过一个区域时才能进行 处于以下状态之一时才能进行。分割|分裂|合并|打开|关闭 在用这个命令手动设置一个区域的状态之前,请 证明该区域没有被运行中的程序处理。例如 "分配 "或 "分割"。你可以在hbase shell中使用 "assign "或 "split "来查看正在运行的程序 你可以使用'list_procedures'命令在hbase shell中查看正在运行的过程。一个例子 设置区域'de00010733901a05f5a2a3a382e27dd4'为关闭状态。
     $ HBCK2 setRegionState de00010733901a05f5a2a3a382e27dd4 CLOSING
   Returns "0" if region state changed and "1" otherwise.
   如果区域状态改变,返回 "0",否则返回 "1"。
   If -i or --inputFiles is specified, pass one or more input file names.
   Each file contains <ENCODED_REGIONNAME> <STATE>, one pair per line.
   For example:
   如果指定了-i或-inputFiles,传递一个或多个输入文件名。每个文件包含<ENCODED_REGIONNAME><STATE>,每行一对。比如说。
     $ HBCK2 setRegionState -i fileName1 fileName2

 setTableState [<TABLENAME> <STATE>|-i <INPUT_FILE>...]
   Options:
     -i,--inputFiles  take one or more input files of table names and states
   Possible table states: ENABLED, DISABLED, DISABLING, ENABLING
   To read current table state, in the hbase shell run:
    接受一个或多个表名和状态的输入文件 可能的表状态。enabled, disabled, disabling, enabling 要读取当前表的状态,在hbase shell中运行
     hbase> get 'hbase:meta', '<TABLENAME>', 'table:state'
   A value of \x08\x00 == ENABLED, \x08\x01 == DISABLED, etc.
   Can also run a 'describe "<TABLENAME>"' at the shell prompt.
   An example making table name 'user' ENABLED:
   一个值为\x08\x00 == ENABLED,\x08\x01 == DISABLED,等等。也可以在shell提示下运行'describe "<TABLENAME>"'。一个例子是使表名 "user "成为ENABLED。
     $ HBCK2 setTableState users ENABLED
   Returns whatever the previous table state was.
   If -i or --inputFiles is specified, pass one or more input file names.
   Each file contains <TABLENAME> <STATE>, one pair per line.
   For example:
   返回上一个表的状态是什么。如果指定了-i或-inputFiles,传递一个或多个输入文件名。每个文件包含<TABLENAME> <STATE>,每行一对。比如说。
     $ HBCK2 setTableState -i fileName1 fileName2

 scheduleRecoveries <SERVERNAME>...|-i <INPUT_FILE>...
  Options:
     -i,--inputFiles  take one or more input files of server names
   Schedule ServerCrashProcedure(SCP) for list of RegionServers. Format
   server name as '<HOSTNAME>,<PORT>,<STARTCODE>' (See HBase UI/logs).
   Example using RegionServer 'a.example.org,29100,1540348649479':
   接受一个或多个服务器名称的输入文件 为 RegionServers 列表安排服务器崩溃程序(SCP)。格式 服务器名称为'<HOSTNAME>,<PORT>,<STARTCODE>'(参见HBase UI/logs)。例如使用RegionServer'a.example.org,29100,1540348649479'。
     $ HBCK2 scheduleRecoveries a.example.org,29100,1540348649479
   Returns the pid(s) of the created ServerCrashProcedure(s) or -1 if
   no procedure created (see master logs for why not).
   返回已创建的ServerCrashProcedure的pid,如果没有创建,则返回-1。则返回-1,如果没有创建任何程序(见主日志中的原因)。
   Command support added in hbase versions 2.0.3, 2.1.2, 2.2.0 or newer.
   在hbase 2.0.3, 2.1.2, 2.2.0或更新的版本中增加了命令支持。
   If -i or --inputFiles is specified, pass one or more input file names.
   Each file contains <SERVERNAME>, one per line. For example:
   如果指定了-i或-inputFiles,传递一个或多个输入文件名。每个文件包含<SERVERNAME>,每行一个。例如。
     $ HBCK2 scheduleRecoveries -i fileName1 fileName2

 unassigns <ENCODED_REGIONNAME>...|-i <INPUT_FILE>...
   Options:
    -o,--override  override ownership by another procedure
    覆盖另一个程序的所有权
     -i,--inputFiles  take one or more input files of encoded names
     接受一个或多个编码名称的输入文件
   A 'raw' unassign that can be used even during Master initialization
   (if the -skip flag is specified). Skirts Coprocessors. Pass one or
   more encoded region names. 1588230740 is the hard-coded name for the
   hbase:meta region and de00010733901a05f5a2a3a382e27dd4 is an example
   of what a userspace encoded region name looks like. For example:
    一个 "原始的 "取消赋值,甚至可以在Master初始化期间使用(如果指定了-skip标志)。裙边协处理器。传递一个或多个编码的区域名称。1588230740是hbase:meta区域的硬编码名称,de00010733901a05f5a2a3a382e27dd4是一个用户空间编码区域名称的例子。例如。
     $ HBCK2 unassign 1588230740 de00010733901a05f5a2a3a382e27dd4
   Returns the pid(s) of the created UnassignProcedure(s) or -1 if none.
   If -i or --inputFiles is specified, pass one or more input file names.
   Each file contains encoded region names, one per line. For example:
   返回创建的UnassignProcedure的pid,如果没有则返回-1。如果指定了-i或-inputFiles,传递一个或多个输入文件名。每个文件包含编码的区域名称,每行一个。比如说
     $ HBCK2 unassigns fileName1 -i fileName2
   SEE ALSO, org.apache.hbase.hbck1.OfflineMetaRepair, the offline
   hbase:meta tool. See the HBCK2 README for how to use.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhghcibb
系列文章
更多 icon
同类精品
更多 icon
继续加载