HBae找不到协处理器导致RegionServer全部挂掉

一、问题背景:

    跟兄弟单位公用一个大数据集群,通过Dataspace结合Kerberos控制数据的访问,我们生产环境中用到的OLAP工具Kylin,在升级Kylin的过程中,由于删除了旧的协处理器,导致原来数据继续去寻找目标协处理器,找不到引起所有RegionServer退出,始终想不明白hbase有关协处理器的机制,于是查找资料才得以清楚。


一下内容为转载,原地址:http://blog.itpub.net/12129601/viewspace-1690668/     主要用于个人收藏、备查。转载请注明原作者。

二、协处理的使用

1 加载协处理器
1.1 将协处理器上传到hdfs:
hadoop fs -mkdir /hbasenew/usercoprocesser
hadoop fs -ls /hbasenew/usercoprocesser
hadoop fs -rm /hbasenew/usercoprocesser/coprocessor.jar
hadoop fs -copyFromLocal /home/hbase/coprocessor.jar  /hbasenew/usercoprocessor
1.2 将协处理器加载到表中:
1)先卸载协处理器:
disable 'ns_bigdata:tb_test_coprocesser'
alter 'ns_bigdata:tb_test_coprocesser',METHOD => 'table_att_unset',NAME =>'coprocessor$1'
enable 'ns_bigdata:tb_test_coprocesser'
2)再加载协处理器:
disable 'ns_bigdata:tb_test_coprocesser'
alter 'ns_bigdata:tb_test_coprocesser',METHOD => 'table_att','coprocessor' => '/hbasenew/usercoprocesser/coprocessor.jar|com.suning.hbase.coprocessor.service.HelloWorldEndPoin|1001|'
enable 'ns_bigdata:tb_test_coprocesser'
注意:在加载协处理器是我特意将协处理器中的类名少写一个字母t,以重现将集群regionserver搞挂的现象以及表的状态不一致的现象。

2 出现的问题
以上操作会导致如下两个问题:
2.1 将集群的region server搞挂掉

2.2 将加载协处理器的表的状态搞的不一致,一直处于enabling状态

对表做disable和enable操作均不可操作:

同时此表对应的regionserver上出现如下错误:

3 原因分析
3.1 关于协处理加载错误导致regionserver挂掉的原因分析
在hbase的源码中,参数:hbase.coprocessor.abortonerror的默认值是true:
public static final String ABORT_ON_ERROR_KEY = "hbase.coprocessor.abortonerror";
  public static final boolean DEFAULT_ABORT_ON_ERROR = true;
下面查看此参数的含义:

      hbase.coprocessor.abortonerror
      true
      Set to true to cause the hosting server (master or regionserver)
      to abort if a coprocessor fails to load, fails to initialize, or throws an
      unexpected Throwable object. Setting this to false will allow the server to
      continue execution but the system wide state of the coprocessor in question
      will become inconsistent as it will be properly executing in only a subset
      of servers, so this is most useful for debugging only. 
因此,当加载错误的协处理器之后,会导致regionserver挂掉。

3.2 关于加载协处理器的表的状态不一致的原因分析:
相关错误日志:

查看enable的相关源码:
public void enableTable(final TableName tableName)
  throws IOException {
    enableTableAsync(tableName);

    // Wait until all regions are enabled
    waitUntilTableIsEnabled(tableName);

    LOG.info("Enabled table " + tableName);
  }
private void waitUntilTableIsEnabled(final TableName tableName) throws IOException {
    boolean enabled = false;
    long start = EnvironmentEdgeManager.currentTimeMillis();
    for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
      try {
        enabled = isTableEnabled(tableName);
      } catch (TableNotFoundException tnfe) {
        // wait for table to be created
        enabled = false;
      }
      enabled = enabled && isTableAvailable(tableName);
      if (enabled) {
        break;
      }
      long sleep = getPauseTime(tries);
      if (LOG.isDebugEnabled()) {
        LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
          "enabled in " + tableName);
      }
      try {
        Thread.sleep(sleep);
      } catch (InterruptedException e) {
        // Do this conversion rather than let it out because do not want to
        // change the method signature.
        throw (InterruptedIOException)new InterruptedIOException("Interrupted").initCause(e);
      }
    }
    if (!enabled) {
      long msec = EnvironmentEdgeManager.currentTimeMillis() - start;
      throw new IOException("Table '" + tableName +
        "' not yet enabled, after " + msec + "ms.");
    }
  }

===========================================================================
  /**
   * Brings a table on-line (enables it).  Method returns immediately though
   * enable of table may take some time to complete, especially if the table
   * is large (All regions are opened as part of enabling process).  Check
   * {@link #isTableEnabled(byte[])} to learn when table is fully online.  If
   * table is taking too long to online, check server logs.
   * @param tableName
   * @throws IOException
   * @since 0.90.0
   */
  public void enableTableAsync(final TableName tableName)
  throws IOException {
    TableName.isLegalFullyQualifiedTableName(tableName.getName());
    executeCallable(new MasterCallable(getConnection()) {
      @Override
      public Void call() throws ServiceException {
        LOG.info("Started enable of " + tableName);
        EnableTableRequest req = RequestConverter.buildEnableTableRequest(tableName);
        master.enableTable(null,req);
        return null;
      }
    });
  }
发现在enable的过程中,首先是执行enable操作,操作完毕后需要等待各个regionserver反馈所有region的状态,由于此时regionserver已经挂掉,一直在连接重试等待,此时表的状态一直是ENABLING。

4 问题的处理
4.1 关于regionserver 挂掉的问题处理:
通过在hbase-site.xml文件中设置参数:
    
    hbase.coprocessor.abortonerror
    false
    
并启动region server可以解决,这样就忽略了协处理器出现的错误,保证集群高可用。
4.2 关于有协处理器的表的状态不一致,不能disable和enable问题的解决办法:
此问题可以通过切换master节点可以解决,将主停掉,backup-master会承担主master的任务,同时在切换的过程中,会将状态不一致的表的状态改为一致的:

切换后的master信息如下:

在切换的过程中调用了如下方法:
  /**
   * Recover the tables that are not fully moved to ENABLED state. These tables
   * are in ENABLING state when the master restarted/switched
   *
   * @throws KeeperException
   * @throws org.apache.hadoop.hbase.TableNotFoundException
   * @throws IOException
   */
  private void recoverTableInEnablingState()
      throws KeeperException, TableNotFoundException, IOException {
    Set enablingTables = ZKTable.getEnablingTables(watcher);
    if (enablingTables.size() != 0) {
      for (TableName tableName : enablingTables) {
        // Recover by calling EnableTableHandler
        LOG.info("The table " + tableName
            + " is in ENABLING state.  Hence recovering by moving the table"
            + " to ENABLED state.");
        // enableTable in sync way during master startup,
        // no need to invoke coprocessor
        EnableTableHandler eth = new EnableTableHandler(this.server, tableName,
          catalogTracker, this, tableLockManager, true);
        try {
          eth.prepare();
        } catch (TableNotFoundException e) {
          LOG.warn("Table " + tableName + " not found in hbase:meta to recover.");
          continue;
        }
        eth.process();
      }
    }
  }
在却换过程中,跟踪master和对应的regionserver的后台日志:
master日志:
其中的部分日志信息如下:
2015-05-20 10:00:01,398 INFO  [master:nim-pre:60000] master.AssignmentManager: The table ns_bigdata:tb_test_coprocesser is in ENABLING state.  Hence recovering by moving the table to ENABLED state.
2015-05-20 10:00:01,421 DEBUG [master:nim-pre:60000] lock.ZKInterProcessLockBase: Acquired a lock for /hbasen/table-lock/ns_bigdata:tb_test_coprocesser/write-master:600000000000002
2015-05-20 10:00:01,436 INFO  [master:nim-pre:60000] handler.EnableTableHandler: Attempting to enable the table ns_bigdata:tb_test_coprocesser
2015-05-20 10:00:01,465 INFO  [master:nim-pre:60000] handler.EnableTableHandler: Table 'ns_bigdata:tb_test_coprocesser' has 1 regions, of which 1 are offline.
2015-05-20 10:00:01,466 INFO  [master:nim-pre:60000] balancer.BaseLoadBalancer: Reassigned 1 regions. 1 retained the pre-restart assignment.
2015-05-20 10:00:01,466 INFO  [master:nim-pre:60000] handler.EnableTableHandler: Bulk assigning 1 region(s) across 3 server(s), retainAssignment=true
对应的regionserver的日志如下:
2015-05-20 14:39:56,175 INFO  [master:sup02-pre:60000] master.AssignmentManager: The table ns_bigdata:tb_test_coprocesser is in ENABLING state.  Hence recovering by moving the table to ENABLED state.
2015-05-20 14:39:56,211 DEBUG [master:sup02-pre:60000] lock.ZKInterProcessLockBase: Acquired a lock for /hbasen/table-lock/ns_bigdata:tb_test_coprocesser/write-master:600000000000031
2015-05-20 14:39:56,235 INFO  [master:sup02-pre:60000] handler.EnableTableHandler: Attempting to enable the table ns_bigdata:tb_test_coprocesser
2015-05-20 14:39:56,269 INFO  [master:sup02-pre:60000] handler.EnableTableHandler: Table 'ns_bigdata:tb_test_coprocesser' has 1 regions, of which 1 are offline.
2015-05-20 14:39:56,270 INFO  [master:sup02-pre:60000] balancer.BaseLoadBalancer: Reassigned 1 regions. 1 retained the pre-restart assignment.
2015-05-20 14:39:56,270 INFO  [master:sup02-pre:60000] handler.EnableTableHandler: Bulk assigning 1 region(s) across 3 server(s), retainAssignment=true

结论:
1. 为了提高集群的高可用性,应该将参数:hbase.coprocessor.abortonerror设置为true,这样即使加载的协处理器有问题,也不会导致集群的regionserver挂掉,也不会导致表不能enable和disable;
2.即使表出现不能enable和disable的现象后,也可以通过切换master来解决,因此在搭建集群时,一定要至少有一到两个backupmaster

5 全部master节点宕后集群的读写测试
1. 在集群都是正常的情况下,通过客户端往集群中插入2000000行数据,插入正常
2.将集群的所有master全部停掉:

3.监控客户端的数据插入情况,发现客户端的数据插入正常。持续让客户端继续插入20000000行数据,发现数据插入正常。
4.在客户端批量读取数据,发现数据读取正常。
结论:当hbase集群的master所有节点挂掉后(一定时间段,目前测试的是半小时内),客户端的数据读写正常。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/570716.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Spark SQL的整体实现逻辑

1、sql语句的模块解析 当我们写一个查询语句时&#xff0c;一般包含三个部分&#xff0c;select部分&#xff0c;from数据源部分&#xff0c;where限制条件部分&#xff0c;这三部分的内容在sql中有专门的名称&#xff1a; 当我们写sql时&#xff0c;如上图所示&#xff0c;在进…

Mysql的高可用方案及主从详细配置

1、常用的高可用MySQL解决方案&#xff1a; 数据库作为最基础的数据存储服务之一&#xff0c;在存储系统中有着非常重要的地位&#xff0c;因此要求其具备高可用性无可厚非。能实现不同SLA(服务水平协定)的解决方案有很多种&#xff0c;这些方案可以保证数据 库服务器在硬件或…

vue3+element plus组件库中el-carousel组件走马灯特效,当图片变动时下面数字也随着图片动态变化

1.效果图 2.html <section style"height:30%"><div class"left-img1-title"><img src"../assets/img/title.png"alt""srcset""><div class"text">回收垃圾数量</div></div>…

数据库MySQL/mariadb知识点——数据类型

数据类型 所谓的列类型&#xff0c;其实就是指数据类型&#xff0c;即对数据进行统一的分类&#xff0c;从系统的角度出发是为了能够使用统一的方式进行管理&#xff0c;更好的利用有限的空间。 在 SQL 中&#xff0c;将数据类型分成了三大类&#xff0c;分别为&#xff1a;数值…

HDFS查看文件的前几行-后几行-行数

随机返回指定行数的样本数据 hadoop fs -cat /test/gonganbu/scene_analysis_suggestion/* | shuf -n 5 返回前几行的样本数据 hadoop fs -cat /test/gonganbu/scene_analysis_suggestion/* | head -100 返回最后几行的样本数据 hadoop fs -cat /test/gonganbu/scene_anal…

psql: FATAL the database system is in recovery解决

报错&#xff1a; FATAL: the database system is in recovery mode 解决思路&#xff1a; 在hawq master节点 1、执行hawq state &#xff0c;提示 database is down 2、查看hawq master进程&#xff1a; ps aux | grep postgresql &#xff0c;发现master进程不在 3、查…

软件工具组功能逆向工程设想

背景&#xff1a;昨天小智公布了软件工具组现在的几个项目组&#xff0c;大概罗列了现阶段软件工具组的主要职能&#xff0c;总结起来说就是将现有设计方案生成渲染图、全景图、视频、CAD等&#xff0c;看完所有这些功能我不禁设想了一下&#xff0c;如果软件工具组的功能逆向工…

FAIL : SSHException: Incompatible ssh peer (no acceptable kex algorithm)

问题描述&#xff1a; 在安装greenplum&#xff0c;执行gpssh-exkeys过程中抛出异常 Incompatible ssh peer (no acceptable kex algorithm) 原因&#xff1a; 由于ssh 6.7以上屏蔽不安全算法 解决&#xff1a; 在/etc/ssh/sshd_config最后加上 KexAlgorithms curve25519…

集群监控之Ganglia的部署

转载地址&#xff1a;https://www.slothparadise.com/how-to-install-ganglia-on-centos-7/ 找了一堆文章&#xff0c;全都误导了&#xff0c;这篇正解。 总结步骤如下&#xff1a; 1、server端 &#xff1a; yum install -y ganglia-gmetad ganglia-web ganglia-gmond rrd…

期货大赛项目|九,fileinput插件的应用

引入JS和CSS bundles.Add(new ScriptBundle("~/bundles/fileinputJs").Include( "~/Content/vendors/bootstrap-fileinput-master/js/fileinput.min.js", "~/Content/vendors/bootstrap-fileinput-master/js/locales/zh.js", "~/Scripts/fi…

redis见解

http://blog.csdn.net/zhiguozhu/article/details/50517527Redis原生session与redis中的session区别原生session在服务器上是以文件的形式存储的&#xff0c;所以其有一些磁盘io上的缺点 1&#xff09; 有哪几种类型的数据结构String——字符串  value 不仅可以是 String&…

快速解读GC日志

文章转载自&#xff1a;http://blog.csdn.net/renfufei/article/details/49230943 本文是 Plumbr 发行的 Java垃圾收集指南 的部分内容。文中将介绍GC日志的输出格式, 以及如何解读GC日志, 从中提取有用的信息。我们通过 -XX:UseSerialGC 选项,指定JVM使用串行垃圾收集器, 并使…

HBase meta元数据损坏导致hbase master初始化失败

故障起因&#xff1a; 跑kylin任务&#xff0c;过程出错&#xff0c;异常信息&#xff1a;Direct buffer memory&#xff0c; java.io.IOException: java.lang.OutOfMemoryError: Direct buffer memoryat org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.ha…

HBase shell执行批量脚本

场景描述&#xff1a; HBase namespace中有大量无用的小表&#xff0c;占用了过多的block&#xff0c;需要批量删除&#xff0c;了解了一下有两种方式&#xff1a; 1、使用通配符 用drop命令可以删除表。在删除一个表之前必须先将其禁用。 hbase(main):018:0> disable em…

时间序列分析综述

一.基本分类 1.单变量的传统时间序列分析 2.单变量的随机时间序列分析 3.多变量的时间序列分析 建立在回归基础上的两变量序列分析 建立在AR基础上的多变量序列分析 4.截面时序数据结合的分析 转载于:https://www.cnblogs.com/xyp666/p/9220667.html

Ubuntu开启允许root用户远程登录

SSH服务器&#xff0c;可以通过SSH协议来访问远程服务器&#xff0c;代替telnet和ftp。但是ubuntu默认是不启用root用户也不允许root远程登录的。所以需要先启用root用户 1、启用root用户&#xff1a; 第一步 sudo passwd root //修改密码 第二步&#xff1a; vim /usr…

补码(为什么按位取反再加一):告诉你一个其实很简单的问题(转自醍醐灌顶)...

首先&#xff0c;阅读这篇文章的你&#xff0c;肯定是一个在网上已经纠结了很久的读者&#xff0c;因为你查阅了所有你能查到的资料&#xff0c;然后他们都会很耐心的告诉你&#xff0c;补码&#xff1a;就是按位取反&#xff0c;然后加一。准确无误&#xff0c;毫无破绽。但是…

Kettle报错:Entry to update with following key could not be found

问题描述&#xff1a; 一个转换对一个表进行插入操作&#xff0c;第一次查询然后插入数据&#xff0c;但是有些字段需要特殊处理下&#xff0c;也就是要先插入主要的信息&#xff0c;然后针对这个记录根据刚才生成的id进行更新操作&#xff0c;在开发环境上测试没问题&#xf…

IntrospectorCleanupListener作用

https://www.cnblogs.com/qiankun-site/p/5886673.html 1、此监听器主要用于解决java.beans.Introspector导致的内存泄漏的问题 2、此监听器应该配置在web.xml中与Spring相关监听器中的第一个位置(也要在ContextLoaderListener的前面)3、JDK中的java.beans.Introspector类的用途…

CentOS安装Oracle12C

文章转载&#xff1a; https://www.howtoforge.com/tutorial/how-to-install-oracle-database-12c-on-centos-7/