YARN-1665. Simplify the configuration of RM HA by having better default values. Contributed by Xuan Gong.

svn merge --ignore-ancestry -c 1565517 ../../trunk/


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1565518 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2014-02-07 02:40:02 +00:00
parent 6729189cc2
commit c16df11991
7 changed files with 21 additions and 12 deletions

View File

@ -113,6 +113,9 @@ Release 2.4.0 - UNRELEASED
be available across RM failover by making using of a remote be available across RM failover by making using of a remote
configuration-provider. (Xuan Gong via vinodkv) configuration-provider. (Xuan Gong via vinodkv)
YARN-1665. Simplify the configuration of RM HA by having better default
values. (Xuan Gong via vinodkv)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -373,11 +373,11 @@ public class YarnConfiguration extends Configuration {
public static final String AUTO_FAILOVER_ENABLED = public static final String AUTO_FAILOVER_ENABLED =
AUTO_FAILOVER_PREFIX + "enabled"; AUTO_FAILOVER_PREFIX + "enabled";
public static final boolean DEFAULT_AUTO_FAILOVER_ENABLED = false; public static final boolean DEFAULT_AUTO_FAILOVER_ENABLED = true;
public static final String AUTO_FAILOVER_EMBEDDED = public static final String AUTO_FAILOVER_EMBEDDED =
AUTO_FAILOVER_PREFIX + "embedded"; AUTO_FAILOVER_PREFIX + "embedded";
public static final boolean DEFAULT_AUTO_FAILOVER_EMBEDDED = false; public static final boolean DEFAULT_AUTO_FAILOVER_EMBEDDED = true;
public static final String AUTO_FAILOVER_ZK_BASE_PATH = public static final String AUTO_FAILOVER_ZK_BASE_PATH =
AUTO_FAILOVER_PREFIX + "zk-base-path"; AUTO_FAILOVER_PREFIX + "zk-base-path";

View File

@ -172,8 +172,6 @@ public void testExplicitFailover()
@Test @Test
public void testAutomaticFailover() public void testAutomaticFailover()
throws YarnException, InterruptedException, IOException { throws YarnException, InterruptedException, IOException {
conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, true);
conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_EMBEDDED, true);
conf.set(YarnConfiguration.RM_CLUSTER_ID, "yarn-test-cluster"); conf.set(YarnConfiguration.RM_CLUSTER_ID, "yarn-test-cluster");
conf.set(YarnConfiguration.RM_ZK_ADDRESS, hostPort); conf.set(YarnConfiguration.RM_ZK_ADDRESS, hostPort);
conf.setInt(YarnConfiguration.RM_ZK_TIMEOUT_MS, 2000); conf.setInt(YarnConfiguration.RM_ZK_TIMEOUT_MS, 2000);
@ -193,6 +191,7 @@ public void testAutomaticFailover()
@Test @Test
public void testWebAppProxyInStandAloneMode() throws YarnException, public void testWebAppProxyInStandAloneMode() throws YarnException,
InterruptedException, IOException { InterruptedException, IOException {
conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
WebAppProxyServer webAppProxyServer = new WebAppProxyServer(); WebAppProxyServer webAppProxyServer = new WebAppProxyServer();
try { try {
conf.set(YarnConfiguration.PROXY_ADDRESS, "0.0.0.0:9099"); conf.set(YarnConfiguration.PROXY_ADDRESS, "0.0.0.0:9099");
@ -227,6 +226,7 @@ public void testWebAppProxyInStandAloneMode() throws YarnException,
@Test @Test
public void testEmbeddedWebAppProxy() throws YarnException, public void testEmbeddedWebAppProxy() throws YarnException,
InterruptedException, IOException { InterruptedException, IOException {
conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
cluster.init(conf); cluster.init(conf);
cluster.start(); cluster.start();
getAdminService(0).transitionToActive(req); getAdminService(0).transitionToActive(req);

View File

@ -405,17 +405,20 @@
</property> </property>
<property> <property>
<description>Enable automatic failover.</description> <description>Enable automatic failover.
By default, it is enabled only when HA is enabled</description>
<name>yarn.resourcemanager.ha.automatic-failover.enabled</name> <name>yarn.resourcemanager.ha.automatic-failover.enabled</name>
<value>false</value> <value>true</value>
</property> </property>
<property> <property>
<description>Enable embedded automatic failover. The embedded elector <description>Enable embedded automatic failover.
relies on the RM state store to handle fencing, and is primarily intended By default, it is enabled only when HA is enabled.
to be used in conjunction with ZKRMStateStore.</description> The embedded elector relies on the RM state store to handle fencing,
and is primarily intended to be used in conjunction with ZKRMStateStore.
</description>
<name>yarn.resourcemanager.ha.automatic-failover.embedded</name> <name>yarn.resourcemanager.ha.automatic-failover.embedded</name>
<value>false</value> <value>true</value>
</property> </property>
<property> <property>

View File

@ -119,6 +119,7 @@ private void checkActiveRMFunctionality() throws IOException {
*/ */
@Test (timeout = 30000) @Test (timeout = 30000)
public void testStartAndTransitions() throws IOException { public void testStartAndTransitions() throws IOException {
configuration.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
Configuration conf = new YarnConfiguration(configuration); Configuration conf = new YarnConfiguration(configuration);
rm = new MockRM(conf); rm = new MockRM(conf);
rm.init(conf); rm.init(conf);
@ -178,7 +179,6 @@ public void testTransitionsWhenAutomaticFailoverEnabled() throws IOException {
"automatic failover is enabled"; "automatic failover is enabled";
Configuration conf = new YarnConfiguration(configuration); Configuration conf = new YarnConfiguration(configuration);
conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, true);
rm = new MockRM(conf); rm = new MockRM(conf);
rm.init(conf); rm.init(conf);
@ -236,6 +236,7 @@ public void testRMDispatcherForHA() throws IOException {
String errorMessageForEventHandler = String errorMessageForEventHandler =
"Expect to get the same number of handlers"; "Expect to get the same number of handlers";
String errorMessageForService = "Expect to get the same number of services"; String errorMessageForService = "Expect to get the same number of services";
configuration.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
Configuration conf = new YarnConfiguration(configuration); Configuration conf = new YarnConfiguration(configuration);
rm = new MockRM(conf) { rm = new MockRM(conf) {
@Override @Override

View File

@ -159,6 +159,7 @@ public void testFencing() throws Exception {
HAServiceProtocol.RequestSource.REQUEST_BY_USER); HAServiceProtocol.RequestSource.REQUEST_BY_USER);
Configuration conf1 = createHARMConf("rm1,rm2", "rm1", 1234); Configuration conf1 = createHARMConf("rm1,rm2", "rm1", 1234);
conf1.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
ResourceManager rm1 = new ResourceManager(); ResourceManager rm1 = new ResourceManager();
rm1.init(conf1); rm1.init(conf1);
rm1.start(); rm1.start();
@ -170,6 +171,7 @@ public void testFencing() throws Exception {
rm1.getRMContext().getRMAdminService().getServiceStatus().getState()); rm1.getRMContext().getRMAdminService().getServiceStatus().getState());
Configuration conf2 = createHARMConf("rm1,rm2", "rm2", 5678); Configuration conf2 = createHARMConf("rm1,rm2", "rm2", 5678);
conf2.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
ResourceManager rm2 = new ResourceManager(); ResourceManager rm2 = new ResourceManager();
rm2.init(conf2); rm2.init(conf2);
rm2.start(); rm2.start();

View File

@ -42,7 +42,7 @@ public class TestMiniYARNClusterForHA {
@Before @Before
public void setup() throws IOException, InterruptedException { public void setup() throws IOException, InterruptedException {
Configuration conf = new YarnConfiguration(); Configuration conf = new YarnConfiguration();
conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
cluster = new MiniYARNCluster(TestMiniYARNClusterForHA.class.getName(), cluster = new MiniYARNCluster(TestMiniYARNClusterForHA.class.getName(),
2, 1, 1, 1); 2, 1, 1, 1);
cluster.init(conf); cluster.init(conf);