首页 > 解决方案 > 如何中止/终止 HBase 中的过程

问题描述

当我尝试创建一个新表时,我遇到了 2 个卡住的 hbase 程序。我认为当时区域服务器上可能发生了错误。

现在我找到一个标记为“WAITING”的父过程,它的子过程标记为“WAITING_TIMEOUT”。

我想中止/杀死这两个程序,但我不知道该怎么做,而且似乎 hbase shell 的“kill”操作不支持程序。

我的 hbase 版本是 2.0.2 并且在 yarn 上运行。

我已尝试重新启动 hbase,但程序仍然存在并且仍然卡住。

家长程序

id:
54206

parent:
Empty, no parent

state: 
WAITING

type:
ServerCrashProcedure server=slave.server.com,16020,1558012223746, splitWal=true, meta=false

子程序

id:
54266

parent:
54206

state:
WAITING_TIMEOUT

type:
AssignProcedure table=my_namespace:my_table, region=18b04016f7b5619c9fbd6dfcdf72e9d4

标签: hbase

解决方案


我偶然遇到了这个问题,我将发布解决方案,因为 HBase 2.x 仍然是当前的稳定版本。

简短介绍

从 HBase2 开始,有一个名为“HBase Operator Tools”的单独工具,在处理任何严重的 HBase 集群问题时,它是您最好的朋友(在许多情况下也是唯一的选择)。它可以从 Apache HBase 站点下载。

我的理解是,他们决定从 HBase 发行版中“取出”这个工具,以便让我们(用户/管理员)使用最新的管理工具,而无需升级 HBase 版本本身。

如何安装和使用 HBCK2

  1. 从https://hbase.apache.org/downloads.html(HBase Operator Tools 部分)下载最新的 HBase Operator Tools 二进制文件(tar.gz 文件)
  2. 在集群的一个节点上提取它(我在 HBase 主服务器上),最好是在hbase或其他 HBase 管理员用户上。解压后你会发现一个名为hbase-operator-tools-1.1.0/hbase-hbck2 的目录,里面有一堆罐子(1.1.0 是我写这个答案时的最新版本)
  3. kinit如果启用了 Kerberos
  4. 运行hbase hbck -j hbase-operator-tools-1.1.0/hbase-hbck2/hbase-hbck2-1.1.0.jar,你会看到一堆解释得很清楚的选项,比如:addFsRegionsMissingInMeta、、、等等assignssetRegionStatefixMeta

重要的是要意识到,这个工具也可以在 Zookeeper 级别上运行,因此即使 HBase 本身无法启动,它也会为您提供帮助,例如 HBase Master 启动由于某些区域正在转换而卡住

终于解决了

运行 hbase hbck -j hbase-operator-tools-1.1.0/hbase-hbck2/hbase-hbck2-1.1.0.jar --help 时会有一个选项bypass,这正是您所需要的:

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

所以最后:

hbase hbck -j hbase-operator-tools-1.1.0/hbase-hbck2/hbase-hbck2-1.1.0.jar bypass -o -r PROCEDURE_PID

程序连同它的父母应该被杀死。


推荐阅读