|
@@ -60,6 +60,8 @@ public class HSAdmin extends Configured implements Tool {
|
|
.println("Usage: mapred hsadmin [-refreshSuperUserGroupsConfiguration]");
|
|
.println("Usage: mapred hsadmin [-refreshSuperUserGroupsConfiguration]");
|
|
} else if ("-refreshAdminAcls".equals(cmd)) {
|
|
} else if ("-refreshAdminAcls".equals(cmd)) {
|
|
System.err.println("Usage: mapred hsadmin [-refreshAdminAcls]");
|
|
System.err.println("Usage: mapred hsadmin [-refreshAdminAcls]");
|
|
|
|
+ } else if ("-refreshLogRetentionSettings".equals(cmd)) {
|
|
|
|
+ System.err.println("Usage: mapred hsadmin [-refreshLogRetentionSettings]");
|
|
} else if ("-getGroups".equals(cmd)) {
|
|
} else if ("-getGroups".equals(cmd)) {
|
|
System.err.println("Usage: mapred hsadmin" + " [-getGroups [username]]");
|
|
System.err.println("Usage: mapred hsadmin" + " [-getGroups [username]]");
|
|
} else {
|
|
} else {
|
|
@@ -67,6 +69,7 @@ public class HSAdmin extends Configured implements Tool {
|
|
System.err.println(" [-refreshUserToGroupsMappings]");
|
|
System.err.println(" [-refreshUserToGroupsMappings]");
|
|
System.err.println(" [-refreshSuperUserGroupsConfiguration]");
|
|
System.err.println(" [-refreshSuperUserGroupsConfiguration]");
|
|
System.err.println(" [-refreshAdminAcls]");
|
|
System.err.println(" [-refreshAdminAcls]");
|
|
|
|
+ System.err.println(" [-refreshLogRetentionSettings]");
|
|
System.err.println(" [-getGroups [username]]");
|
|
System.err.println(" [-getGroups [username]]");
|
|
System.err.println(" [-help [cmd]]");
|
|
System.err.println(" [-help [cmd]]");
|
|
System.err.println();
|
|
System.err.println();
|
|
@@ -89,6 +92,8 @@ public class HSAdmin extends Configured implements Tool {
|
|
|
|
|
|
String refreshAdminAcls = "-refreshAdminAcls: Refresh acls for administration of Job history server\n";
|
|
String refreshAdminAcls = "-refreshAdminAcls: Refresh acls for administration of Job history server\n";
|
|
|
|
|
|
|
|
+ String refreshLogRetentionSettings = "-refreshLogRetentionSettings: Refresh 'log retention time' and 'log retention check interval' \n";
|
|
|
|
+
|
|
String getGroups = "-getGroups [username]: Get the groups which given user belongs to\n";
|
|
String getGroups = "-getGroups [username]: Get the groups which given user belongs to\n";
|
|
|
|
|
|
String help = "-help [cmd]: \tDisplays help for the given command or all commands if none\n"
|
|
String help = "-help [cmd]: \tDisplays help for the given command or all commands if none\n"
|
|
@@ -102,6 +107,8 @@ public class HSAdmin extends Configured implements Tool {
|
|
System.out.println(refreshSuperUserGroupsConfiguration);
|
|
System.out.println(refreshSuperUserGroupsConfiguration);
|
|
} else if ("refreshAdminAcls".equals(cmd)) {
|
|
} else if ("refreshAdminAcls".equals(cmd)) {
|
|
System.out.println(refreshAdminAcls);
|
|
System.out.println(refreshAdminAcls);
|
|
|
|
+ } else if ("refreshLogRetentionSettings".equals(cmd)) {
|
|
|
|
+ System.out.println(refreshLogRetentionSettings);
|
|
} else if ("getGroups".equals(cmd)) {
|
|
} else if ("getGroups".equals(cmd)) {
|
|
System.out.println(getGroups);
|
|
System.out.println(getGroups);
|
|
} else {
|
|
} else {
|
|
@@ -109,6 +116,7 @@ public class HSAdmin extends Configured implements Tool {
|
|
System.out.println(refreshUserToGroupsMappings);
|
|
System.out.println(refreshUserToGroupsMappings);
|
|
System.out.println(refreshSuperUserGroupsConfiguration);
|
|
System.out.println(refreshSuperUserGroupsConfiguration);
|
|
System.out.println(refreshAdminAcls);
|
|
System.out.println(refreshAdminAcls);
|
|
|
|
+ System.out.println(refreshLogRetentionSettings);
|
|
System.out.println(getGroups);
|
|
System.out.println(getGroups);
|
|
System.out.println(help);
|
|
System.out.println(help);
|
|
System.out.println();
|
|
System.out.println();
|
|
@@ -198,6 +206,22 @@ public class HSAdmin extends Configured implements Tool {
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private int refreshLogRetentionSettings() throws IOException {
|
|
|
|
+ // Refresh log retention settings
|
|
|
|
+ Configuration conf = getConf();
|
|
|
|
+ InetSocketAddress address = conf.getSocketAddr(
|
|
|
|
+ JHAdminConfig.JHS_ADMIN_ADDRESS,
|
|
|
|
+ JHAdminConfig.DEFAULT_JHS_ADMIN_ADDRESS,
|
|
|
|
+ JHAdminConfig.DEFAULT_JHS_ADMIN_PORT);
|
|
|
|
+
|
|
|
|
+ HSAdminRefreshProtocol refreshProtocol = HSProxies
|
|
|
|
+ .createProxy(conf, address, HSAdminRefreshProtocol.class,
|
|
|
|
+ UserGroupInformation.getCurrentUser());
|
|
|
|
+
|
|
|
|
+ refreshProtocol.refreshLogRetentionSettings();
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public int run(String[] args) throws Exception {
|
|
public int run(String[] args) throws Exception {
|
|
if (args.length < 1) {
|
|
if (args.length < 1) {
|
|
@@ -211,7 +235,8 @@ public class HSAdmin extends Configured implements Tool {
|
|
|
|
|
|
if ("-refreshUserToGroupsMappings".equals(cmd)
|
|
if ("-refreshUserToGroupsMappings".equals(cmd)
|
|
|| "-refreshSuperUserGroupsConfiguration".equals(cmd)
|
|
|| "-refreshSuperUserGroupsConfiguration".equals(cmd)
|
|
- || "-refreshAdminAcls".equals(cmd)) {
|
|
|
|
|
|
+ || "-refreshAdminAcls".equals(cmd)
|
|
|
|
+ || "-refreshLogRetentionSettings".equals(cmd)) {
|
|
if (args.length != 1) {
|
|
if (args.length != 1) {
|
|
printUsage(cmd);
|
|
printUsage(cmd);
|
|
return exitCode;
|
|
return exitCode;
|
|
@@ -225,6 +250,8 @@ public class HSAdmin extends Configured implements Tool {
|
|
exitCode = refreshSuperUserGroupsConfiguration();
|
|
exitCode = refreshSuperUserGroupsConfiguration();
|
|
} else if ("-refreshAdminAcls".equals(cmd)) {
|
|
} else if ("-refreshAdminAcls".equals(cmd)) {
|
|
exitCode = refreshAdminAcls();
|
|
exitCode = refreshAdminAcls();
|
|
|
|
+ } else if ("-refreshLogRetentionSettings".equals(cmd)) {
|
|
|
|
+ exitCode = refreshLogRetentionSettings();
|
|
} else if ("-getGroups".equals(cmd)) {
|
|
} else if ("-getGroups".equals(cmd)) {
|
|
String[] usernames = Arrays.copyOfRange(args, i, args.length);
|
|
String[] usernames = Arrays.copyOfRange(args, i, args.length);
|
|
exitCode = getGroups(usernames);
|
|
exitCode = getGroups(usernames);
|