方式一: 重新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;

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

被折叠的 条评论
为什么被折叠?



