hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [1/4] hbase git commit: HBASE-13282 Fix the minor issues of running Canary on kerberized environment (Srikanth Srungarapu)
Date Fri, 20 Mar 2015 21:27:38 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 3a420fd3f -> 2c6a4a642
  refs/heads/branch-1 b83e3ac77 -> 4230b1ae2
  refs/heads/branch-1.0 7e877ea22 -> d38433808
  refs/heads/master f4eb7191b -> 091519116


HBASE-13282 Fix the minor issues of running Canary on kerberized environment (Srikanth Srungarapu)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4230b1ae
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4230b1ae
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4230b1ae

Branch: refs/heads/branch-1
Commit: 4230b1ae2e77334b5463cbe117cdcc8d24254dec
Parents: b83e3ac
Author: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Authored: Fri Mar 20 21:14:07 2015 +0000
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Fri Mar 20 21:14:07 2015 +0000

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/AuthUtil.java  |  6 +++---
 .../org/apache/hadoop/hbase/tool/Canary.java    | 21 ++++++++++++--------
 2 files changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4230b1ae/hbase-common/src/main/java/org/apache/hadoop/hbase/AuthUtil.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/AuthUtil.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/AuthUtil.java
index f597935..4754ea4 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/AuthUtil.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/AuthUtil.java
@@ -59,10 +59,10 @@ public class AuthUtil {
           conf.get("hbase.client.dns.nameserver", "default")));
       userProvider.login("hbase.client.keytab.file", "hbase.client.kerberos.principal", host);
     } catch (UnknownHostException e) {
-      LOG.error("Error resolving host name");
+      LOG.error("Error resolving host name: " + e.getMessage(), e);
       throw e;
     } catch (IOException e) {
-      LOG.error("Error while trying to perform the initial login");
+      LOG.error("Error while trying to perform the initial login: " + e.getMessage(), e);
       throw e;
     }
 
@@ -93,7 +93,7 @@ public class AuthUtil {
         try {
           ugi.checkTGTAndReloginFromKeytab();
         } catch (IOException e) {
-          LOG.info("Got exception while trying to refresh credentials ");
+          LOG.error("Got exception while trying to refresh credentials: " + e.getMessage(),
e);
         }
       }
     };

http://git-wip-us.apache.org/repos/asf/hbase/blob/4230b1ae/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
index 309a1c2..625828f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
@@ -160,6 +160,7 @@ public final class Canary implements Tool {
   @Override
   public int run(String[] args) throws Exception {
     int index = -1;
+    ChoreService choreService = null;
 
     // Process command line args
     for (int i = 0; i < args.length; i++) {
@@ -233,6 +234,15 @@ public final class Canary implements Tool {
       }
     }
 
+    // Launches chore for refreshing kerberos credentials if security is enabled.
+    // Please see http://hbase.apache.org/book.html#_running_canary_in_a_kerberos_enabled_cluster
+    // for more details.
+    final ScheduledChore authChore = AuthUtil.getAuthChore(conf);
+    if (authChore != null) {
+      choreService = new ChoreService("CANARY_TOOL");
+      choreService.scheduleChore(authChore);
+    }
+
     // Start to prepare the stuffs
     Monitor monitor = null;
     Thread monitorThread = null;
@@ -287,6 +297,9 @@ public final class Canary implements Tool {
       } while (interval > 0);
     } // try-with-resources close
 
+    if (choreService != null) {
+      choreService.shutdown();
+    }
     return(monitor.errorCode);
   }
 
@@ -775,15 +788,7 @@ public final class Canary implements Tool {
 
   public static void main(String[] args) throws Exception {
     final Configuration conf = HBaseConfiguration.create();
-    final ChoreService choreService = new ChoreService("CANARY_TOOL");
-    final ScheduledChore authChore = AuthUtil.getAuthChore(conf);
-    if (authChore != null) {
-      choreService.scheduleChore(authChore);
-    }
-
     int exitCode = ToolRunner.run(conf, new Canary(), args);
-
-    choreService.shutdown();
     System.exit(exitCode);
   }
 }


Mime
View raw message