HBASE-13282 Fix the minor issues of running Canary on kerberized environment (Srikanth Srungarapu)
This commit is contained in:
parent
b83e3ac770
commit
4230b1ae2e
|
@ -59,10 +59,10 @@ public class AuthUtil {
|
||||||
conf.get("hbase.client.dns.nameserver", "default")));
|
conf.get("hbase.client.dns.nameserver", "default")));
|
||||||
userProvider.login("hbase.client.keytab.file", "hbase.client.kerberos.principal", host);
|
userProvider.login("hbase.client.keytab.file", "hbase.client.kerberos.principal", host);
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
LOG.error("Error resolving host name");
|
LOG.error("Error resolving host name: " + e.getMessage(), e);
|
||||||
throw e;
|
throw e;
|
||||||
} catch (IOException 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;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class AuthUtil {
|
||||||
try {
|
try {
|
||||||
ugi.checkTGTAndReloginFromKeytab();
|
ugi.checkTGTAndReloginFromKeytab();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.info("Got exception while trying to refresh credentials ");
|
LOG.error("Got exception while trying to refresh credentials: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -160,6 +160,7 @@ public final class Canary implements Tool {
|
||||||
@Override
|
@Override
|
||||||
public int run(String[] args) throws Exception {
|
public int run(String[] args) throws Exception {
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
ChoreService choreService = null;
|
||||||
|
|
||||||
// Process command line args
|
// Process command line args
|
||||||
for (int i = 0; i < args.length; i++) {
|
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
|
// Start to prepare the stuffs
|
||||||
Monitor monitor = null;
|
Monitor monitor = null;
|
||||||
Thread monitorThread = null;
|
Thread monitorThread = null;
|
||||||
|
@ -287,6 +297,9 @@ public final class Canary implements Tool {
|
||||||
} while (interval > 0);
|
} while (interval > 0);
|
||||||
} // try-with-resources close
|
} // try-with-resources close
|
||||||
|
|
||||||
|
if (choreService != null) {
|
||||||
|
choreService.shutdown();
|
||||||
|
}
|
||||||
return(monitor.errorCode);
|
return(monitor.errorCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,15 +788,7 @@ public final class Canary implements Tool {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
final Configuration conf = HBaseConfiguration.create();
|
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);
|
int exitCode = ToolRunner.run(conf, new Canary(), args);
|
||||||
|
|
||||||
choreService.shutdown();
|
|
||||||
System.exit(exitCode);
|
System.exit(exitCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue