Index: src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 1483526) +++ src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 1483527) @@ -3782,7 +3782,11 @@ return "RS-" + serverInfo.getServerName(); } + /** + * Reload the configuration from disk. + */ public void updateConfiguration() { + LOG.info("Reloading the configuration from disk."); conf.reloadConfiguration(); for (HRegion r : onlineRegions.values()) { r.updateConfiguration(); Index: src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (revision 1483526) +++ src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (revision 1483527) @@ -1375,7 +1375,8 @@ updateConfiguration(new HServerAddress(hostNameWithPort)); } - private void updateConfiguration(HServerAddress address) throws IOException { + // Update configuration for region server at this address. + public void updateConfiguration(HServerAddress address) throws IOException { HRegionInterface server = connection.getHRegionConnection(address); server.updateConfiguration(); } Index: bin/reload_rs_config.rb =================================================================== --- bin/reload_rs_config.rb (revision 0) +++ bin/reload_rs_config.rb (revision 1483527) @@ -0,0 +1,111 @@ +# +# Copyright 2013 The Apache Software Foundation +# +# 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. +# +# This script can be used to make either the region server running on the +# current host reload, or make all the region servers reload the configuration. +# +# To see usage for this script, run: +# +# ${HBASE_HOME}/bin/hbase org.jruby.Main ${HBASE_HOME}/bin/reload_rs_config.rb usage +# +include Java +import org.apache.hadoop.conf.Configuration +import org.apache.hadoop.hbase.ClusterStatus +import org.apache.hadoop.hbase.HBaseConfiguration +import org.apache.hadoop.hbase.HServerInfo +import org.apache.hadoop.hbase.HServerAddress +import org.apache.hadoop.hbase.client.HBaseAdmin +import org.apache.hadoop.hbase.util.Bytes +import org.apache.hadoop.hbase.HConstants +import org.apache.commons.logging.LogFactory +import java.net.InetAddress + +# Name of this script +NAME = "reload_rs_config" + +def usage + puts 'Usage %s.rb [reloadAll]' % NAME + puts 'Use reloadAll to make all the Region Servers reload their configurations' + exit! +end + +reloadAll = false + +if ARGV.size > 1 + usage +elsif ARGV.size == 1 + if ARGV[0] == 'reloadAll' + reloadAll = true + else + usage + end +end + +# Get configuration to use. +c = HBaseConfiguration.create() + +# Taken from add_table.rb script +# Set hadoop filesystem configuration using the hbase.rootdir. +# Otherwise, we'll always use localhost though the hbase.rootdir +# might be pointing at hdfs location. +c.set("fs.default.name", c.get(HConstants::HBASE_DIR)) + +# Get a logger instance. +LOG = LogFactory.getLog(NAME) + +# get the admin interface +admin = HBaseAdmin.new(c) + +hostname = InetAddress.getLocalHost().getHostName() +port = c.getInt("hbase.regionserver.port", 0) + +if reloadAll + # get the cluster servers + servers = admin.getClusterStatus().getServerInfo() + + servers.each do |server| + address = server.getServerAddress() + puts "Updating the configuration at host " + address.getHostname() + admin.updateConfiguration(address) + end +else + if port > 0 + address = HServerAddress.new(hostname, port) + else + address = nil + + # get the cluster servers + servers = admin.getClusterStatus().getServerInfo() + + servers.each do |server| + if server.getServerAddress().getHostname() == InetAddress.getLocalHost().getHostName() + address = server.getServerAddress() + break + end + end + end + + if address == nil + puts "invalid server" + exit + end + + admin.updateConfiguration(address) +end +