From d15cbae73c7ae22d5d60d8cba16cba565e8e8b20 Mon Sep 17 00:00:00 2001 From: Xuan Date: Wed, 14 Jan 2015 11:04:03 -0800 Subject: [PATCH] YARN-2807. Option "--forceactive" not works as described in usage of "yarn rmadmin -transitionToActive". Contributed by Masatake Iwasaki --- .../java/org/apache/hadoop/ha/HAAdmin.java | 10 ++-- hadoop-yarn-project/CHANGES.txt | 3 ++ .../src/site/apt/ResourceManagerHA.apt.vm | 1 + .../src/site/apt/YarnCommands.apt.vm | 48 ++++++++++++++----- 4 files changed, 44 insertions(+), 18 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java index a6c4a42f22..f72df7739e 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java @@ -69,15 +69,15 @@ public abstract class HAAdmin extends Configured implements Tool { protected final static Map USAGE = ImmutableMap.builder() .put("-transitionToActive", - new UsageInfo(" [--"+FORCEACTIVE+"]", "Transitions the service into Active state")) + new UsageInfo("[--"+FORCEACTIVE+"] ", "Transitions the service into Active state")) .put("-transitionToStandby", new UsageInfo("", "Transitions the service into Standby state")) .put("-failover", new UsageInfo("[--"+FORCEFENCE+"] [--"+FORCEACTIVE+"] ", "Failover from the first service to the second.\n" + - "Unconditionally fence services if the "+FORCEFENCE+" option is used.\n" + + "Unconditionally fence services if the --"+FORCEFENCE+" option is used.\n" + "Try to failover to the target service even if it is not ready if the " + - FORCEACTIVE + " option is used.")) + "--" + FORCEACTIVE + " option is used.")) .put("-getServiceState", new UsageInfo("", "Returns the state of the service")) .put("-checkHealth", @@ -228,7 +228,7 @@ private boolean checkManualStateManagementOK(HAServiceTarget target) { "Refusing to manually manage HA state, since it may cause\n" + "a split-brain scenario or other incorrect state.\n" + "If you are very sure you know what you are doing, please \n" + - "specify the " + FORCEMANUAL + " flag."); + "specify the --" + FORCEMANUAL + " flag."); return false; } else { LOG.warn("Proceeding with manual HA state management even though\n" + @@ -462,7 +462,7 @@ protected int runCmd(String[] argv) throws Exception { private boolean confirmForceManual() throws IOException { return ToolRunner.confirmPrompt( - "You have specified the " + FORCEMANUAL + " flag. This flag is " + + "You have specified the --" + FORCEMANUAL + " flag. This flag is " + "dangerous, as it can induce a split-brain scenario that WILL " + "CORRUPT your HDFS namespace, possibly irrecoverably.\n" + "\n" + diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 1d2acc13f4..a398347243 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -186,6 +186,9 @@ Release 2.7.0 - UNRELEASED YARN-3019. Make work-preserving-recovery the default mechanism for RM recovery. (Jian He via junping_du) + YARN-2807. Option "--forceactive" not works as described in usage of + "yarn rmadmin -transitionToActive". (Masatake Iwasaki via xgong) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/ResourceManagerHA.apt.vm b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/ResourceManagerHA.apt.vm index 8cfdd79b00..0346cda8f1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/ResourceManagerHA.apt.vm +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/ResourceManagerHA.apt.vm @@ -208,6 +208,7 @@ ResourceManager High Availability +---+ If automatic failover is enabled, you can not use manual transition command. + Though you can override this by --forcemanual flag, you need caution. +---+ $ yarn rmadmin -transitionToStandby rm1 diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/YarnCommands.apt.vm b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/YarnCommands.apt.vm index 2de901bad0..6333d70163 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/YarnCommands.apt.vm +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/YarnCommands.apt.vm @@ -246,13 +246,19 @@ YARN Commands Usage: ---- - yarn rmadmin [-refreshQueues] [-refreshNodes] [-refreshUserToGroupsMapping] - [-refreshSuperUserGroupsConfiguration] [-refreshAdminAcls] - [-refreshServiceAcl] [-getGroups [username]] [-help [cmd]] - [-transitionToActive ] - [-transitionToStandby ] - [-getServiceState ] - [-checkHealth ] + yarn rmadmin [-refreshQueues] + [-refreshNodes] + [-refreshUserToGroupsMapping] + [-refreshSuperUserGroupsConfiguration] + [-refreshAdminAcls] + [-refreshServiceAcl] + [-getGroups [username]] + [-transitionToActive [--forceactive] [--forcemanual] ] + [-transitionToStandby [--forcemanual] ] + [-failover [--forcefence] [--forceactive] ] + [-getServiceState ] + [-checkHealth ] + [-help [cmd]] ---- *---------------+--------------+ @@ -277,14 +283,26 @@ YARN Commands *---------------+--------------+ | -getGroups [username] | Get groups the specified user belongs to. *---------------+--------------+ -| -help [cmd] | Displays help for the given command or all commands if none is -| | specified. +| -transitionToActive [--forceactive] [--forcemanual] \ | +| | Transitions the service into Active state. +| | Try to make the target active +| | without checking that there is no active node +| | if the --forceactive option is used. +| | This command can not be used if automatic failover is enabled. +| | Though you can override this by --forcemanual option, +| | you need caution. *---------------+--------------+ -| -transitionToActive \ | Transitions the service into Active -| | state. +| -transitionToStandby [--forcemanual] \ | +| | Transitions the service into Standby state. +| | This command can not be used if automatic failover is enabled. +| | Though you can override this by --forcemanual option, +| | you need caution. *---------------+--------------+ -| -transitionToStandby \ | Transitions the service into Standby -| | state. +| -failover [--forceactive] \ \ | +| | Initiate a failover from serviceId1 to serviceId2. +| | Try to failover to the target service even if it is not ready +| | if the --forceactive option is used. +| | This command can not be used if automatic failover is enabled. *---------------+--------------+ | -getServiceState \ | Returns the state of the service. *---------------+--------------+ @@ -292,6 +310,10 @@ YARN Commands | | check. The RMAdmin tool will exit with a | | non-zero exit code if the check fails. *---------------+--------------+ +| -help [cmd] | Displays help for the given command or all commands if none is +| | specified. +*---------------+--------------+ + Runs ResourceManager admin client