hbase 某台regionserver更换ip后出现块不同步的现象

本文介绍HBase集群中RegionServer的两种平滑重启方法:一是使用修复元数据脚本重新分配块;二是采用graceful_stop.sh脚本先迁移Region再重启,避免服务中断。同时,强调了配置修改后的重启策略及不当重启可能带来的问题。

方式一: 重新hbase集群让metedata识别新ip,使用修复元数据,重新分配块的脚本 rephbase.sh

#!/bin/bash
su - hbase <<EOF
hbase hbck -fixMeta -fixAssignments
hbase hbck -repair
hbase hbck -fixEmptyMetaCells
hbase hbck
EOF

方式二:如果一没有成功,例如出现如下错误
在这里插入图片描述
进入ambari hbase master uI 观察节点状态发现新节点ip已经存在并且数据在上面,但是旧节点的主机名也存在,块在新ip节点上,所以需要通过graceful脚本

graceful_stop.sh 命令为 在hbase/bin 下 执行此脚本 graceful_stop.sh 10.0.30.139
graceful_stop.sh脚本内容:

#!/usr/bin/env bash
#
#/**
# * Licensed to the Apache Software Foundation (ASF) under one
# * or more contributor license agreements.  See the NOTICE file
# * distributed with this work for additional information
# * regarding copyright ownership.  The ASF licenses this file
# * to you under the Apache License, Version 2.0 (the
# * "License"); you may not use this file except in compliance
# * with the License.  You may obtain a copy of the License at
# *
# *     http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# */

# Move regions off a server then stop it.  Optionally restart and reload.
# Turn off the balancer before running this script.
function usage {
   
   
  echo "Usage: graceful_stop.sh [--config <conf-dir>] [-d] [-e] [--restart [--reload]] [--thrift] [--rest] <hostname>"
  echo " thrift         If we should stop/start thrift before/after the hbase stop/start"
  echo " rest           If we should stop/start rest before/after the hbase stop/start"
  echo " restart        If we should restart after graceful stop"
  echo " reload         Move offloaded regions back on to the restarted server"
  echo " d|debug        Print helpful debug information"
  echo " maxthreads xx  Limit the number of threads used by the region mover. Default value is 1."
  echo " hostname       Hostname of server we are to stop"
  echo " e|failfast     Set -e so exit immediately if any command exits with non-zero status"
  exit 1
}

if [ $# -lt 1 ]; then
  usage
fi

bin=`dirname "$0"`
bin=`cd "$bin">/dev/null; 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值