From f34975ecddb47661f709029e7ee5f400fe056e22 Mon Sep 17 00:00:00 2001 From: manukranthk Date: Mon, 20 Oct 2014 21:32:16 -0700 Subject: [PATCH] [HBASE-12286] Adding HBase Admin method for updating configuration online --- hbase-shell/src/main/ruby/hbase/admin.rb | 13 ++++++++ hbase-shell/src/main/ruby/shell.rb | 9 ++++++ .../ruby/shell/commands/update_all_rs_config.rb | 37 ++++++++++++++++++++++ .../main/ruby/shell/commands/update_rs_config.rb | 37 ++++++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 hbase-shell/src/main/ruby/shell/commands/update_all_rs_config.rb create mode 100644 hbase-shell/src/main/ruby/shell/commands/update_rs_config.rb diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb index 77c2759..f93cbe4 100644 --- a/hbase-shell/src/main/ruby/hbase/admin.rb +++ b/hbase-shell/src/main/ruby/hbase/admin.rb @@ -22,6 +22,7 @@ java_import java.util.Arrays java_import org.apache.hadoop.hbase.util.Pair java_import org.apache.hadoop.hbase.util.RegionSplitter java_import org.apache.hadoop.hbase.util.Bytes +java_import org.apache.hadoop.hbase.ServerName java_import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos::SnapshotDescription java_import org.apache.commons.collections.MapUtils @@ -780,6 +781,18 @@ module Hbase end #---------------------------------------------------------------------------------------------- + # Updates the configuration of one regionserver. + def update_rs_config(serverName) + @admin.updateConfiguration(ServerName.valueOf(serverName)); + end + + #---------------------------------------------------------------------------------------------- + # Updates the configuration of all the regionservers. + def update_all_rs_config() + @admin.updateConfiguration(); + end + + #---------------------------------------------------------------------------------------------- # Returns namespace's structure description def describe_namespace(namespace_name) namespace = @admin.getNamespaceDescriptor(namespace_name) diff --git a/hbase-shell/src/main/ruby/shell.rb b/hbase-shell/src/main/ruby/shell.rb index 1cfd3d6..c348b1a 100644 --- a/hbase-shell/src/main/ruby/shell.rb +++ b/hbase-shell/src/main/ruby/shell.rb @@ -361,6 +361,15 @@ Shell.load_command_group( ) Shell.load_command_group( + 'configuration', + :full_name => 'ONLINE CONFIGURATION TOOLS', + :commands => %w[ + update_rs_config + update_all_rs_config + ] +) + +Shell.load_command_group( 'quotas', :full_name => 'CLUSTER QUOTAS TOOLS', :commands => %w[ diff --git a/hbase-shell/src/main/ruby/shell/commands/update_all_rs_config.rb b/hbase-shell/src/main/ruby/shell/commands/update_all_rs_config.rb new file mode 100644 index 0000000..a21a1aa --- /dev/null +++ b/hbase-shell/src/main/ruby/shell/commands/update_all_rs_config.rb @@ -0,0 +1,37 @@ +# +# +# 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. +# + +module Shell + module Commands + class UpdateAllRsConfig < Command + def help + return <<-EOF +Start enable of named table: + hbase> update_all_rs_config +EOF + end + + def command() + format_simple_command do + admin.update_all_rs_config() + end + end + end + end +end diff --git a/hbase-shell/src/main/ruby/shell/commands/update_rs_config.rb b/hbase-shell/src/main/ruby/shell/commands/update_rs_config.rb new file mode 100644 index 0000000..de76ff1 --- /dev/null +++ b/hbase-shell/src/main/ruby/shell/commands/update_rs_config.rb @@ -0,0 +1,37 @@ +# +# +# 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. +# + +module Shell + module Commands + class UpdateRsConfig < Command + def help + return <<-EOF +Start enable of named table: + hbase> update_rs_config 'servername' +EOF + end + + def command(serverName) + format_simple_command do + admin.update_rs_config(serverName) + end + end + end + end +end -- 1.9.4