|
@@ -19,6 +19,7 @@
|
|
|
package org.apache.hadoop.yarn.server.router;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.io.PrintStream;
|
|
|
import java.net.InetAddress;
|
|
|
import java.net.URL;
|
|
|
import java.net.InetSocketAddress;
|
|
@@ -36,6 +37,7 @@ import org.apache.hadoop.security.HttpCrossOriginFilterInitializer;
|
|
|
import org.apache.hadoop.security.SecurityUtil;
|
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
|
import org.apache.hadoop.service.CompositeService;
|
|
|
+import org.apache.hadoop.util.GenericOptionsParser;
|
|
|
import org.apache.hadoop.util.JvmPauseMonitor;
|
|
|
import org.apache.hadoop.util.ShutdownHookManager;
|
|
|
import org.apache.hadoop.util.StringUtils;
|
|
@@ -295,18 +297,29 @@ public class Router extends CompositeService {
|
|
|
StringUtils.startupShutdownMessage(Router.class, argv, LOG);
|
|
|
Router router = new Router();
|
|
|
try {
|
|
|
-
|
|
|
- // Remove the old hook if we are rebooting.
|
|
|
- if (null != routerShutdownHook) {
|
|
|
- ShutdownHookManager.get().removeShutdownHook(routerShutdownHook);
|
|
|
+ GenericOptionsParser hParser = new GenericOptionsParser(conf, argv);
|
|
|
+ argv = hParser.getRemainingArgs();
|
|
|
+ if (argv.length > 1) {
|
|
|
+ if (argv[0].equals("-format-state-store")) {
|
|
|
+ // TODO: YARN-11548. [Federation] Router Supports Format FederationStateStore.
|
|
|
+ System.err.println("format-state-store is not yet supported.");
|
|
|
+ } else if (argv[0].equals("-remove-application-from-state-store") && argv.length == 2) {
|
|
|
+ // TODO: YARN-11547. [Federation]
|
|
|
+ // Router Supports Remove individual application records from FederationStateStore.
|
|
|
+ System.err.println("remove-application-from-state-store is not yet supported.");
|
|
|
+ } else {
|
|
|
+ printUsage(System.err);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // Remove the old hook if we are rebooting.
|
|
|
+ if (null != routerShutdownHook) {
|
|
|
+ ShutdownHookManager.get().removeShutdownHook(routerShutdownHook);
|
|
|
+ }
|
|
|
+ routerShutdownHook = new CompositeServiceShutdownHook(router);
|
|
|
+ ShutdownHookManager.get().addShutdownHook(routerShutdownHook, SHUTDOWN_HOOK_PRIORITY);
|
|
|
+ router.init(conf);
|
|
|
+ router.start();
|
|
|
}
|
|
|
-
|
|
|
- routerShutdownHook = new CompositeServiceShutdownHook(router);
|
|
|
- ShutdownHookManager.get().addShutdownHook(routerShutdownHook,
|
|
|
- SHUTDOWN_HOOK_PRIORITY);
|
|
|
-
|
|
|
- router.init(conf);
|
|
|
- router.start();
|
|
|
} catch (Throwable t) {
|
|
|
LOG.error("Error starting Router", t);
|
|
|
System.exit(-1);
|
|
@@ -348,4 +361,9 @@ public class Router extends CompositeService {
|
|
|
public FedAppReportFetcher getFetcher() {
|
|
|
return fetcher;
|
|
|
}
|
|
|
+
|
|
|
+ private static void printUsage(PrintStream out) {
|
|
|
+ out.println("Usage: yarn router [-format-state-store] | " +
|
|
|
+ "[-remove-application-from-state-store <appId>]");
|
|
|
+ }
|
|
|
}
|