YARN-2807. Option "--forceactive" not works as described in usage of

"yarn rmadmin -transitionToActive". Contributed by Masatake Iwasaki
This commit is contained in:
Xuan 2015-01-14 11:04:03 -08:00
parent d336d13678
commit d15cbae73c
4 changed files with 44 additions and 18 deletions

View File

@ -69,15 +69,15 @@ public abstract class HAAdmin extends Configured implements Tool {
protected final static Map<String, UsageInfo> USAGE = protected final static Map<String, UsageInfo> USAGE =
ImmutableMap.<String, UsageInfo>builder() ImmutableMap.<String, UsageInfo>builder()
.put("-transitionToActive", .put("-transitionToActive",
new UsageInfo("<serviceId> [--"+FORCEACTIVE+"]", "Transitions the service into Active state")) new UsageInfo("[--"+FORCEACTIVE+"] <serviceId>", "Transitions the service into Active state"))
.put("-transitionToStandby", .put("-transitionToStandby",
new UsageInfo("<serviceId>", "Transitions the service into Standby state")) new UsageInfo("<serviceId>", "Transitions the service into Standby state"))
.put("-failover", .put("-failover",
new UsageInfo("[--"+FORCEFENCE+"] [--"+FORCEACTIVE+"] <serviceId> <serviceId>", new UsageInfo("[--"+FORCEFENCE+"] [--"+FORCEACTIVE+"] <serviceId> <serviceId>",
"Failover from the first service to the second.\n" + "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 " + "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", .put("-getServiceState",
new UsageInfo("<serviceId>", "Returns the state of the service")) new UsageInfo("<serviceId>", "Returns the state of the service"))
.put("-checkHealth", .put("-checkHealth",
@ -228,7 +228,7 @@ public abstract class HAAdmin extends Configured implements Tool {
"Refusing to manually manage HA state, since it may cause\n" + "Refusing to manually manage HA state, since it may cause\n" +
"a split-brain scenario or other incorrect state.\n" + "a split-brain scenario or other incorrect state.\n" +
"If you are very sure you know what you are doing, please \n" + "If you are very sure you know what you are doing, please \n" +
"specify the " + FORCEMANUAL + " flag."); "specify the --" + FORCEMANUAL + " flag.");
return false; return false;
} else { } else {
LOG.warn("Proceeding with manual HA state management even though\n" + LOG.warn("Proceeding with manual HA state management even though\n" +
@ -462,7 +462,7 @@ public abstract class HAAdmin extends Configured implements Tool {
private boolean confirmForceManual() throws IOException { private boolean confirmForceManual() throws IOException {
return ToolRunner.confirmPrompt( 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 " + "dangerous, as it can induce a split-brain scenario that WILL " +
"CORRUPT your HDFS namespace, possibly irrecoverably.\n" + "CORRUPT your HDFS namespace, possibly irrecoverably.\n" +
"\n" + "\n" +

View File

@ -186,6 +186,9 @@ Release 2.7.0 - UNRELEASED
YARN-3019. Make work-preserving-recovery the default mechanism for RM YARN-3019. Make work-preserving-recovery the default mechanism for RM
recovery. (Jian He via junping_du) 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 OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -208,6 +208,7 @@ ResourceManager High Availability
+---+ +---+
If automatic failover is enabled, you can not use manual transition command. 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 $ yarn rmadmin -transitionToStandby rm1

View File

@ -246,13 +246,19 @@ YARN Commands
Usage: Usage:
---- ----
yarn rmadmin [-refreshQueues] [-refreshNodes] [-refreshUserToGroupsMapping] yarn rmadmin [-refreshQueues]
[-refreshSuperUserGroupsConfiguration] [-refreshAdminAcls] [-refreshNodes]
[-refreshServiceAcl] [-getGroups [username]] [-help [cmd]] [-refreshUserToGroupsMapping]
[-transitionToActive <serviceId>] [-refreshSuperUserGroupsConfiguration]
[-transitionToStandby <serviceId>] [-refreshAdminAcls]
[-refreshServiceAcl]
[-getGroups [username]]
[-transitionToActive [--forceactive] [--forcemanual] <serviceId>]
[-transitionToStandby [--forcemanual] <serviceId>]
[-failover [--forcefence] [--forceactive] <serviceId1> <serviceId2>]
[-getServiceState <serviceId>] [-getServiceState <serviceId>]
[-checkHealth <serviceId>] [-checkHealth <serviceId>]
[-help [cmd]]
---- ----
*---------------+--------------+ *---------------+--------------+
@ -277,14 +283,26 @@ YARN Commands
*---------------+--------------+ *---------------+--------------+
| -getGroups [username] | Get groups the specified user belongs to. | -getGroups [username] | Get groups the specified user belongs to.
*---------------+--------------+ *---------------+--------------+
| -help [cmd] | Displays help for the given command or all commands if none is | -transitionToActive [--forceactive] [--forcemanual] \<serviceId\> |
| | specified. | | 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 \<serviceId\> | Transitions the service into Active | -transitionToStandby [--forcemanual] \<serviceId\> |
| | state. | | 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 \<serviceId\> | Transitions the service into Standby | -failover [--forceactive] \<serviceId1\> \<serviceId2\> |
| | state. | | 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 \<serviceId\> | Returns the state of the service. | -getServiceState \<serviceId\> | Returns the state of the service.
*---------------+--------------+ *---------------+--------------+
@ -292,6 +310,10 @@ YARN Commands
| | check. The RMAdmin tool will exit with a | | check. The RMAdmin tool will exit with a
| | non-zero exit code if the check fails. | | 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 Runs ResourceManager admin client