|
@@ -44,7 +44,7 @@ import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
|
import org.apache.hadoop.ipc.RPC;
|
|
import org.apache.hadoop.ipc.RPC;
|
|
import org.apache.hadoop.ipc.RemoteException;
|
|
import org.apache.hadoop.ipc.RemoteException;
|
|
import org.apache.hadoop.net.NetUtils;
|
|
import org.apache.hadoop.net.NetUtils;
|
|
-import org.apache.hadoop.security.RefreshUserToGroupMappingsProtocol;
|
|
|
|
|
|
+import org.apache.hadoop.security.RefreshUserMappingsProtocol;
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
import org.apache.hadoop.security.authorize.RefreshAuthorizationPolicyProtocol;
|
|
import org.apache.hadoop.security.authorize.RefreshAuthorizationPolicyProtocol;
|
|
import org.apache.hadoop.util.StringUtils;
|
|
import org.apache.hadoop.util.StringUtils;
|
|
@@ -475,6 +475,7 @@ public class DFSAdmin extends FsShell {
|
|
"\t[" + ClearSpaceQuotaCommand.USAGE +"]\n" +
|
|
"\t[" + ClearSpaceQuotaCommand.USAGE +"]\n" +
|
|
"\t[-refreshServiceAcl]\n" +
|
|
"\t[-refreshServiceAcl]\n" +
|
|
"\t[-refreshUserToGroupsMappings]\n" +
|
|
"\t[-refreshUserToGroupsMappings]\n" +
|
|
|
|
+ "\t[refreshSuperUserGroupsConfiguration]\n" +
|
|
"\t[-printTopology]\n" +
|
|
"\t[-printTopology]\n" +
|
|
"\t[-help [cmd]]\n";
|
|
"\t[-help [cmd]]\n";
|
|
|
|
|
|
@@ -532,6 +533,9 @@ public class DFSAdmin extends FsShell {
|
|
String refreshUserToGroupsMappings =
|
|
String refreshUserToGroupsMappings =
|
|
"-refreshUserToGroupsMappings: Refresh user-to-groups mappings\n";
|
|
"-refreshUserToGroupsMappings: Refresh user-to-groups mappings\n";
|
|
|
|
|
|
|
|
+ String refreshSuperUserGroupsConfiguration =
|
|
|
|
+ "-refreshSuperUserGroupsConfiguration: Refresh superuser proxy groups mappings\n";
|
|
|
|
+
|
|
String printTopology = "-printTopology: Print a tree of the racks and their\n" +
|
|
String printTopology = "-printTopology: Print a tree of the racks and their\n" +
|
|
"\t\tnodes as reported by the Namenode\n";
|
|
"\t\tnodes as reported by the Namenode\n";
|
|
|
|
|
|
@@ -566,6 +570,8 @@ public class DFSAdmin extends FsShell {
|
|
System.out.println(refreshServiceAcl);
|
|
System.out.println(refreshServiceAcl);
|
|
} else if ("refreshUserToGroupsMappings".equals(cmd)) {
|
|
} else if ("refreshUserToGroupsMappings".equals(cmd)) {
|
|
System.out.println(refreshUserToGroupsMappings);
|
|
System.out.println(refreshUserToGroupsMappings);
|
|
|
|
+ } else if ("refreshSuperUserGroupsConfiguration".equals(cmd)) {
|
|
|
|
+ System.out.println(refreshSuperUserGroupsConfiguration);
|
|
} else if ("printTopology".equals(cmd)) {
|
|
} else if ("printTopology".equals(cmd)) {
|
|
System.out.println(printTopology);
|
|
System.out.println(printTopology);
|
|
} else if ("help".equals(cmd)) {
|
|
} else if ("help".equals(cmd)) {
|
|
@@ -585,6 +591,8 @@ public class DFSAdmin extends FsShell {
|
|
System.out.println(SetSpaceQuotaCommand.DESCRIPTION);
|
|
System.out.println(SetSpaceQuotaCommand.DESCRIPTION);
|
|
System.out.println(ClearSpaceQuotaCommand.DESCRIPTION);
|
|
System.out.println(ClearSpaceQuotaCommand.DESCRIPTION);
|
|
System.out.println(refreshServiceAcl);
|
|
System.out.println(refreshServiceAcl);
|
|
|
|
+ System.out.println(refreshUserToGroupsMappings);
|
|
|
|
+ System.out.println(refreshSuperUserGroupsConfiguration);
|
|
System.out.println(printTopology);
|
|
System.out.println(printTopology);
|
|
System.out.println(help);
|
|
System.out.println(help);
|
|
System.out.println();
|
|
System.out.println();
|
|
@@ -767,20 +775,51 @@ public class DFSAdmin extends FsShell {
|
|
conf.get(DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY, ""));
|
|
conf.get(DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY, ""));
|
|
|
|
|
|
// Create the client
|
|
// Create the client
|
|
- RefreshUserToGroupMappingsProtocol refreshProtocol =
|
|
|
|
- (RefreshUserToGroupMappingsProtocol)
|
|
|
|
- RPC.getProxy(RefreshUserToGroupMappingsProtocol.class,
|
|
|
|
- RefreshUserToGroupMappingsProtocol.versionID,
|
|
|
|
- NameNode.getAddress(conf), getUGI(), conf,
|
|
|
|
- NetUtils.getSocketFactory(conf,
|
|
|
|
- RefreshUserToGroupMappingsProtocol.class));
|
|
|
|
-
|
|
|
|
|
|
+ RefreshUserMappingsProtocol refreshProtocol =
|
|
|
|
+ (RefreshUserMappingsProtocol)
|
|
|
|
+ RPC.getProxy(RefreshUserMappingsProtocol.class,
|
|
|
|
+ RefreshUserMappingsProtocol.versionID,
|
|
|
|
+ NameNode.getAddress(conf), getUGI(), conf,
|
|
|
|
+ NetUtils.getSocketFactory(conf,
|
|
|
|
+ RefreshUserMappingsProtocol.class));
|
|
|
|
+
|
|
// Refresh the user-to-groups mappings
|
|
// Refresh the user-to-groups mappings
|
|
refreshProtocol.refreshUserToGroupsMappings(conf);
|
|
refreshProtocol.refreshUserToGroupsMappings(conf);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * refreshSuperUserGroupsConfiguration {@link NameNode}.
|
|
|
|
+ * @return exitcode 0 on success, non-zero on failure
|
|
|
|
+ * @throws IOException
|
|
|
|
+ */
|
|
|
|
+ public int refreshSuperUserGroupsConfiguration() throws IOException {
|
|
|
|
+ // Get the current configuration
|
|
|
|
+ Configuration conf = getConf();
|
|
|
|
+
|
|
|
|
+ // for security authorization
|
|
|
|
+ // server principal for this call
|
|
|
|
+ // should be NAMENODE's one.
|
|
|
|
+ conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY,
|
|
|
|
+ conf.get(DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY, ""));
|
|
|
|
+
|
|
|
|
+ // Create the client
|
|
|
|
+ RefreshUserMappingsProtocol refreshProtocol =
|
|
|
|
+ (RefreshUserMappingsProtocol)
|
|
|
|
+ RPC.getProxy(RefreshUserMappingsProtocol.class,
|
|
|
|
+ RefreshUserMappingsProtocol.versionID,
|
|
|
|
+ NameNode.getAddress(conf), getUGI(), conf,
|
|
|
|
+ NetUtils.getSocketFactory(conf,
|
|
|
|
+ RefreshUserMappingsProtocol.class));
|
|
|
|
+
|
|
|
|
+ // Refresh the user-to-groups mappings
|
|
|
|
+ refreshProtocol.refreshSuperUserGroupsConfiguration(conf);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Displays format of commands.
|
|
* Displays format of commands.
|
|
* @param cmd The command that is being executed.
|
|
* @param cmd The command that is being executed.
|
|
@@ -828,6 +867,9 @@ public class DFSAdmin extends FsShell {
|
|
} else if ("-refreshUserToGroupsMappings".equals(cmd)) {
|
|
} else if ("-refreshUserToGroupsMappings".equals(cmd)) {
|
|
System.err.println("Usage: java DFSAdmin"
|
|
System.err.println("Usage: java DFSAdmin"
|
|
+ " [-refreshUserToGroupsMappings]");
|
|
+ " [-refreshUserToGroupsMappings]");
|
|
|
|
+ } else if ("-refreshSuperUserGroupsConfiguration".equals(cmd)) {
|
|
|
|
+ System.err.println("Usage: java DFSAdmin"
|
|
|
|
+ + " [-refreshSuperUserGroupsConfiguration]");
|
|
} else if ("-printTopology".equals(cmd)) {
|
|
} else if ("-printTopology".equals(cmd)) {
|
|
System.err.println("Usage: java DFSAdmin"
|
|
System.err.println("Usage: java DFSAdmin"
|
|
+ " [-printTopology]");
|
|
+ " [-printTopology]");
|
|
@@ -843,6 +885,7 @@ public class DFSAdmin extends FsShell {
|
|
System.err.println(" [-metasave filename]");
|
|
System.err.println(" [-metasave filename]");
|
|
System.err.println(" [-refreshServiceAcl]");
|
|
System.err.println(" [-refreshServiceAcl]");
|
|
System.err.println(" [-refreshUserToGroupsMappings]");
|
|
System.err.println(" [-refreshUserToGroupsMappings]");
|
|
|
|
+ System.err.println(" [-refreshSuperUserGroupsConfiguration]");
|
|
System.err.println(" [-printTopology]");
|
|
System.err.println(" [-printTopology]");
|
|
System.err.println(" ["+SetQuotaCommand.USAGE+"]");
|
|
System.err.println(" ["+SetQuotaCommand.USAGE+"]");
|
|
System.err.println(" ["+ClearQuotaCommand.USAGE+"]");
|
|
System.err.println(" ["+ClearQuotaCommand.USAGE+"]");
|
|
@@ -973,6 +1016,8 @@ public class DFSAdmin extends FsShell {
|
|
exitCode = refreshServiceAcl();
|
|
exitCode = refreshServiceAcl();
|
|
} else if ("-refreshUserToGroupsMappings".equals(cmd)) {
|
|
} else if ("-refreshUserToGroupsMappings".equals(cmd)) {
|
|
exitCode = refreshUserToGroupsMappings();
|
|
exitCode = refreshUserToGroupsMappings();
|
|
|
|
+ } else if ("-refreshSuperUserGroupsConfiguration".equals(cmd)) {
|
|
|
|
+ exitCode = refreshSuperUserGroupsConfiguration();
|
|
} else if ("-printTopology".equals(cmd)) {
|
|
} else if ("-printTopology".equals(cmd)) {
|
|
exitCode = printTopology();
|
|
exitCode = printTopology();
|
|
} else if ("-help".equals(cmd)) {
|
|
} else if ("-help".equals(cmd)) {
|