From 6c08e8e2aadeb5576172abac62c233c82b597105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=96=8C?= <43056633+liubin101@users.noreply.github.com> Date: Wed, 29 May 2024 20:44:36 +0800 Subject: [PATCH] HADOOP-19156. ZooKeeper based state stores use different ZK address configs. (#6767). Contributed by liu bin. Signed-off-by: Ayush Saxena Signed-off-by: He Xiaoqiao --- .../hadoop/util/curator/ZKCuratorManager.java | 36 +++++++++++++++---- .../curator/TestSecureZKCuratorManager.java | 4 +-- .../util/curator/TestZKCuratorManager.java | 5 ++- .../federation/router/RBFConfigKeys.java | 2 ++ .../driver/impl/StateStoreZooKeeperImpl.java | 3 +- .../src/main/resources/hdfs-rbf-default.xml | 7 ++++ .../router/TestRouterHeartbeatService.java | 3 +- .../TestRouterMountTableCacheRefresh.java | 3 +- ...estRouterMountTableCacheRefreshSecure.java | 3 +- .../store/driver/TestStateStoreZK.java | 3 +- .../hadoop/yarn/conf/YarnConfiguration.java | 5 +-- .../conf/TestYarnConfigurationFields.java | 1 - .../src/main/resources/yarn-default.xml | 16 +++++++++ .../impl/ZookeeperFederationStateStore.java | 3 +- .../TestZookeeperFederationStateStore.java | 3 +- .../resourcemanager/ResourceManager.java | 3 +- .../server/resourcemanager/RMHATestBase.java | 2 +- .../recovery/TestZKRMStateStore.java | 6 ++-- ...TestZKRMStateStoreZKClientConnections.java | 2 +- .../conf/TestZKConfigurationStore.java | 3 +- .../src/site/markdown/Federation.md | 8 ++--- .../src/site/markdown/ResourceManagerHA.md | 4 +-- .../site/markdown/ResourceManagerRestart.md | 4 +-- 23 files changed, 86 insertions(+), 43 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/curator/ZKCuratorManager.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/curator/ZKCuratorManager.java index a0cbf86fb9..4f279fbfaf 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/curator/ZKCuratorManager.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/curator/ZKCuratorManager.java @@ -126,7 +126,7 @@ public static List getZKAuths(Configuration conf) * Start the connection to the ZooKeeper ensemble. * @throws IOException If the connection cannot be started. */ - public void start() throws IOException{ + public void start() throws IOException { this.start(new ArrayList<>()); } @@ -139,25 +139,47 @@ public void start(List authInfos) throws IOException { this.start(authInfos, false); } + /** + * Start the connection to the ZooKeeper ensemble. + * @param zkHostPort Host:Port of the ZooKeeper. + * @throws IOException If the connection cannot be started. + */ + public void start(String zkHostPort) throws IOException { + this.start(new ArrayList<>(), false, zkHostPort); + } + + /** + * Start the connection to the ZooKeeper ensemble. + * @param authInfos List of authentication keys. + * @param sslEnabled If the connection should be SSL/TLS encrypted. + * @throws IOException If the connection cannot be started. + */ + public void start(List authInfos, boolean sslEnabled) throws IOException { + this.start(authInfos, sslEnabled, null); + } + /** * Start the connection to the ZooKeeper ensemble. * * @param authInfos List of authentication keys. * @param sslEnabled If the connection should be SSL/TLS encrypted. + * @param zkHostPort Host:Port of the ZooKeeper. * @throws IOException If the connection cannot be started. */ - public void start(List authInfos, boolean sslEnabled) - throws IOException{ + public void start(List authInfos, boolean sslEnabled, String zkHostPort) + throws IOException { ZKClientConfig zkClientConfig = new ZKClientConfig(); // Connect to the ZooKeeper ensemble - String zkHostPort = conf.get(CommonConfigurationKeys.ZK_ADDRESS); if (zkHostPort == null) { - throw new IOException( - CommonConfigurationKeys.ZK_ADDRESS + " is not configured."); + zkHostPort = conf.get(CommonConfigurationKeys.ZK_ADDRESS); + if (zkHostPort == null) { + throw new IOException( + CommonConfigurationKeys.ZK_ADDRESS + " is not configured."); + } + LOG.debug("Configured {} as {}", CommonConfigurationKeys.ZK_ADDRESS, zkHostPort); } - LOG.debug("Configured {} as {}", CommonConfigurationKeys.ZK_ADDRESS, zkHostPort); int numRetries = conf.getInt(CommonConfigurationKeys.ZK_NUM_RETRIES, CommonConfigurationKeys.ZK_NUM_RETRIES_DEFAULT); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/curator/TestSecureZKCuratorManager.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/curator/TestSecureZKCuratorManager.java index 4862c1c798..7720534dc7 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/curator/TestSecureZKCuratorManager.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/curator/TestSecureZKCuratorManager.java @@ -71,9 +71,9 @@ public void setup() throws Exception { DELETE_DATA_DIRECTORY_ON_CLOSE, SERVER_ID, TICK_TIME, MAX_CLIENT_CNXNS, customConfiguration); this.server = new TestingServer(spec, true); - this.hadoopConf.set(CommonConfigurationKeys.ZK_ADDRESS, this.server.getConnectString()); + String zkHostPort = this.server.getConnectString(); this.curator = new ZKCuratorManager(this.hadoopConf); - this.curator.start(new ArrayList<>(), true); + this.curator.start(new ArrayList<>(), true, zkHostPort); } /** diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/curator/TestZKCuratorManager.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/curator/TestZKCuratorManager.java index 69cba8f4ad..354be1d94d 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/curator/TestZKCuratorManager.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/curator/TestZKCuratorManager.java @@ -60,11 +60,10 @@ public void setup() throws Exception { this.server = new TestingServer(); Configuration conf = new Configuration(); - conf.set( - CommonConfigurationKeys.ZK_ADDRESS, this.server.getConnectString()); + String zkHostPort = this.server.getConnectString(); this.curator = new ZKCuratorManager(conf); - this.curator.start(); + this.curator.start(zkHostPort); } @After diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RBFConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RBFConfigKeys.java index 512b1936f4..64f27bd3ba 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RBFConfigKeys.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RBFConfigKeys.java @@ -260,6 +260,8 @@ public class RBFConfigKeys extends CommonConfigurationKeysPublic { FEDERATION_STORE_ZK_DRIVER_PREFIX + "async.max.threads"; public static final int FEDERATION_STORE_ZK_ASYNC_MAX_THREADS_DEFAULT = -1; + public static final String FEDERATION_STORE_ZK_ADDRESS = + FEDERATION_STORE_ZK_DRIVER_PREFIX + "address"; // HDFS Router-based federation File based store implementation specific configs public static final String FEDERATION_STORE_FILE_ASYNC_THREADS = diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreZooKeeperImpl.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreZooKeeperImpl.java index 4b45197f63..1b9331f3b3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreZooKeeperImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreZooKeeperImpl.java @@ -108,9 +108,10 @@ public boolean initDriver() { } else { LOG.info("Init StateStoreZookeeperImpl by sync mode."); } + String zkHostPort = conf.get(RBFConfigKeys.FEDERATION_STORE_ZK_ADDRESS); try { this.zkManager = new ZKCuratorManager(conf); - this.zkManager.start(); + this.zkManager.start(zkHostPort); this.zkAcl = ZKCuratorManager.getZKAcls(conf); } catch (IOException e) { LOG.error("Cannot initialize the ZK connection", e); diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/resources/hdfs-rbf-default.xml b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/resources/hdfs-rbf-default.xml index c49f576675..26b89ce031 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/resources/hdfs-rbf-default.xml +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/resources/hdfs-rbf-default.xml @@ -388,6 +388,13 @@ + + dfs.federation.router.store.driver.zk.address + + Host:Port of the ZooKeeper for StateStoreZooKeeperImpl. + + + dfs.federation.router.store.driver.zk.parent-path /hdfs-federation diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterHeartbeatService.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterHeartbeatService.java index 80f2327037..6260d271aa 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterHeartbeatService.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterHeartbeatService.java @@ -22,7 +22,6 @@ import org.apache.curator.retry.RetryNTimes; import org.apache.curator.test.TestingServer; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.hdfs.server.federation.RouterConfigBuilder; import org.apache.hadoop.hdfs.server.federation.store.RouterStore; import org.apache.hadoop.hdfs.server.federation.store.StateStoreService; @@ -74,7 +73,7 @@ public void setup() throws Exception { .retryPolicy(new RetryNTimes(100, 100)) .build(); curatorFramework.start(); - routerConfig.set(CommonConfigurationKeys.ZK_ADDRESS, connectStr); + routerConfig.set(RBFConfigKeys.FEDERATION_STORE_ZK_ADDRESS, connectStr); router.init(routerConfig); router.start(); diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTableCacheRefresh.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTableCacheRefresh.java index 82bc7d905e..139236d24e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTableCacheRefresh.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTableCacheRefresh.java @@ -32,7 +32,6 @@ import org.apache.curator.test.TestingServer; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.hdfs.server.federation.FederationTestUtils; import org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster; import org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster.RouterContext; @@ -81,7 +80,7 @@ public static void setUp() throws Exception { conf.setClass(RBFConfigKeys.FEDERATION_FILE_RESOLVER_CLIENT_CLASS, RBFConfigKeys.FEDERATION_FILE_RESOLVER_CLIENT_CLASS_DEFAULT, FileSubclusterResolver.class); - conf.set(CommonConfigurationKeys.ZK_ADDRESS, connectString); + conf.set(RBFConfigKeys.FEDERATION_STORE_ZK_ADDRESS, connectString); conf.setBoolean(RBFConfigKeys.DFS_ROUTER_STORE_ENABLE, true); cluster.addRouterOverrides(conf); cluster.startCluster(); diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTableCacheRefreshSecure.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTableCacheRefreshSecure.java index 0cfdaea365..fa81ee5bdd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTableCacheRefreshSecure.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTableCacheRefreshSecure.java @@ -30,7 +30,6 @@ import org.apache.curator.test.TestingServer; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.hdfs.server.federation.FederationTestUtils; import org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster; import org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster.RouterContext; @@ -86,7 +85,7 @@ public static void setUp() throws Exception { conf.setClass(RBFConfigKeys.FEDERATION_FILE_RESOLVER_CLIENT_CLASS, RBFConfigKeys.FEDERATION_FILE_RESOLVER_CLIENT_CLASS_DEFAULT, FileSubclusterResolver.class); - conf.set(CommonConfigurationKeys.ZK_ADDRESS, connectString); + conf.set(RBFConfigKeys.FEDERATION_STORE_ZK_ADDRESS, connectString); conf.setBoolean(RBFConfigKeys.DFS_ROUTER_STORE_ENABLE, true); cluster = new MiniRouterDFSCluster(false, numNameservices, conf); cluster.addRouterOverrides(conf); diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/store/driver/TestStateStoreZK.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/store/driver/TestStateStoreZK.java index 5ddf93e05b..f215ab41c0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/store/driver/TestStateStoreZK.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/store/driver/TestStateStoreZK.java @@ -32,7 +32,6 @@ import org.apache.curator.retry.RetryNTimes; import org.apache.curator.test.TestingServer; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.hdfs.server.federation.router.RBFConfigKeys; import org.apache.hadoop.hdfs.server.federation.store.StateStoreUtils; import org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreZooKeeperImpl; @@ -71,7 +70,7 @@ public static void setupCluster() throws Exception { // Create the ZK State Store Configuration conf = getStateStoreConfiguration(StateStoreZooKeeperImpl.class); - conf.set(CommonConfigurationKeys.ZK_ADDRESS, connectString); + conf.set(RBFConfigKeys.FEDERATION_STORE_ZK_ADDRESS, connectString); // Disable auto-repair of connection conf.setLong(RBFConfigKeys.FEDERATION_STORE_CONNECTION_TEST_MS, TimeUnit.HOURS.toMillis(1)); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java index 2a51065404..7747d4cb73 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java @@ -112,8 +112,6 @@ private static void addDeprecatedKeys() { SYSTEM_METRICS_PUBLISHER_ENABLED), new DeprecationDelta(RM_ZK_ACL, CommonConfigurationKeys.ZK_ACL), new DeprecationDelta(RM_ZK_AUTH, CommonConfigurationKeys.ZK_AUTH), - new DeprecationDelta(RM_ZK_ADDRESS, - CommonConfigurationKeys.ZK_ADDRESS), new DeprecationDelta(RM_ZK_NUM_RETRIES, CommonConfigurationKeys.ZK_NUM_RETRIES), new DeprecationDelta(RM_ZK_TIMEOUT_MS, @@ -4038,6 +4036,9 @@ public static boolean isAclEnabled(Configuration conf) { public static final String DEFAULT_FEDERATION_STATESTORE_CLIENT_CLASS = "org.apache.hadoop.yarn.server.federation.store.impl.MemoryFederationStateStore"; + public static final String FEDERATION_STATESTORE_ZK_ADDRESS = + FEDERATION_PREFIX + "state-store.zk.address"; + public static final String FEDERATION_CACHE_TIME_TO_LIVE_SECS = FEDERATION_PREFIX + "cache-ttl.secs"; // 5 minutes diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java index e4b48c45f3..b63ed40039 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java @@ -142,7 +142,6 @@ public void initializeMemberVariables() { .add(YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_ENABLED); // skip deprecated ZooKeeper settings - configurationPropsToSkipCompare.add(YarnConfiguration.RM_ZK_ADDRESS); configurationPropsToSkipCompare.add(YarnConfiguration.RM_ZK_NUM_RETRIES); configurationPropsToSkipCompare.add(YarnConfiguration.RM_ZK_TIMEOUT_MS); configurationPropsToSkipCompare.add( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml index 275fc08cb2..927d0c1aa4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml @@ -581,6 +581,15 @@ ${yarn.resourcemanager.max-completed-applications} + + Host:Port of the ZooKeeper server to be used by the RM. This + must be supplied when using the ZooKeeper based implementation of the + RM state store and/or embedded automatic failover in an HA setting. + + yarn.resourcemanager.zk-address + + + Full path of the ZooKeeper znode where RM state will be stored. This must be supplied when using @@ -3798,6 +3807,13 @@ org.apache.hadoop.yarn.server.federation.store.impl.MemoryFederationStateStore + + + Host:Port of the ZooKeeper server to be used by the federation state store + + yarn.federation.state-store.zk.address + + The time in seconds after which the federation state store local cache diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java index 63b853e82a..7a511bcffe 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java @@ -265,9 +265,10 @@ public void init(Configuration conf) throws YarnException { baseZNode = conf.get( YarnConfiguration.FEDERATION_STATESTORE_ZK_PARENT_PATH, YarnConfiguration.DEFAULT_FEDERATION_STATESTORE_ZK_PARENT_PATH); + String zkHostPort = conf.get(YarnConfiguration.FEDERATION_STATESTORE_ZK_ADDRESS); try { this.zkManager = new ZKCuratorManager(conf); - this.zkManager.start(); + this.zkManager.start(zkHostPort); } catch (IOException e) { LOG.error("Cannot initialize the ZK connection", e); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/TestZookeeperFederationStateStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/TestZookeeperFederationStateStore.java index ba22a1e189..3c528096f7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/TestZookeeperFederationStateStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/TestZookeeperFederationStateStore.java @@ -27,7 +27,6 @@ import org.apache.curator.retry.RetryNTimes; import org.apache.curator.test.TestingServer; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.metrics2.MetricsRecord; import org.apache.hadoop.metrics2.impl.MetricsCollectorImpl; import org.apache.hadoop.metrics2.impl.MetricsRecords; @@ -94,7 +93,7 @@ public void before() throws IOException, YarnException { curatorFramework.start(); Configuration conf = new YarnConfiguration(); - conf.set(CommonConfigurationKeys.ZK_ADDRESS, connectString); + conf.set(YarnConfiguration.FEDERATION_STATESTORE_ZK_ADDRESS, connectString); conf.setInt(YarnConfiguration.FEDERATION_STATESTORE_MAX_APPLICATIONS, 10); setConf(conf); } catch (Exception e) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java index a3d529c102..143dff30d9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java @@ -410,6 +410,7 @@ protected EmbeddedElector createEmbeddedElector() throws IOException { */ public ZKCuratorManager createAndStartZKManager(Configuration config) throws IOException { + String zkHostPort = config.get(YarnConfiguration.RM_ZK_ADDRESS); ZKCuratorManager manager = new ZKCuratorManager(config); // Get authentication @@ -432,7 +433,7 @@ public ZKCuratorManager createAndStartZKManager(Configuration config.getBoolean(CommonConfigurationKeys.ZK_CLIENT_SSL_ENABLED, config.getBoolean(YarnConfiguration.RM_ZK_CLIENT_SSL_ENABLED, YarnConfiguration.DEFAULT_RM_ZK_CLIENT_SSL_ENABLED)); - manager.start(authInfos, isSSLEnabled); + manager.start(authInfos, isSSLEnabled, zkHostPort); return manager; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/RMHATestBase.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/RMHATestBase.java index ca76c24b87..c4a6e9dad6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/RMHATestBase.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/RMHATestBase.java @@ -64,7 +64,7 @@ public void setup() throws Exception { configuration.setBoolean(YarnConfiguration.RECOVERY_ENABLED, true); configuration.set(YarnConfiguration.RM_STORE, ZKRMStateStore.class.getName()); - configuration.set(CommonConfigurationKeys.ZK_ADDRESS, hostPort); + configuration.set(YarnConfiguration.RM_ZK_ADDRESS, hostPort); configuration.setInt(CommonConfigurationKeys.ZK_TIMEOUT_MS, ZK_TIMEOUT_MS); configuration.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false); configuration.set(YarnConfiguration.RM_CLUSTER_ID, "test-yarn-cluster"); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java index 404fae9d85..bbf5e2ed35 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java @@ -213,7 +213,7 @@ private String getDelegationTokenNode(int rmDTSequenceNumber, int splitIdx) { private RMStateStore createStore(Configuration conf) throws Exception { workingZnode = "/jira/issue/3077/rmstore"; - conf.set(CommonConfigurationKeys.ZK_ADDRESS, + conf.set(YarnConfiguration.RM_ZK_ADDRESS, curatorTestingServer.getConnectString()); conf.set(YarnConfiguration.ZK_RM_STATE_STORE_PARENT_PATH, workingZnode); conf.setLong(YarnConfiguration.RM_EPOCH, epoch); @@ -347,7 +347,7 @@ public Version getCurrentVersion() throws Exception { public RMStateStore getRMStateStore() throws Exception { YarnConfiguration conf = new YarnConfiguration(); workingZnode = "/jira/issue/3077/rmstore"; - conf.set(CommonConfigurationKeys.ZK_ADDRESS, + conf.set(YarnConfiguration.RM_ZK_ADDRESS, curatorTestingServer.getConnectString()); conf.set(YarnConfiguration.ZK_RM_STATE_STORE_PARENT_PATH, workingZnode); this.store = new TestZKRMStateStoreInternal(conf, workingZnode) { @@ -388,7 +388,7 @@ public static Configuration createHARMConf(String rmIds, String rmId, conf.set(YarnConfiguration.RM_HA_IDS, rmIds); conf.setBoolean(YarnConfiguration.RECOVERY_ENABLED, true); conf.set(YarnConfiguration.RM_STORE, ZKRMStateStore.class.getName()); - conf.set(CommonConfigurationKeys.ZK_ADDRESS, + conf.set(YarnConfiguration.RM_ZK_ADDRESS, curatorTestServer.getConnectString()); conf.setInt(CommonConfigurationKeys.ZK_TIMEOUT_MS, ZK_TIMEOUT_MS); conf.set(YarnConfiguration.RM_HA_ID, rmId); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStoreZKClientConnections.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStoreZKClientConnections.java index 752df13ccc..dce2bed552 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStoreZKClientConnections.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStoreZKClientConnections.java @@ -88,7 +88,7 @@ public TestZKRMStateStore(Configuration conf, String workingZnode) public RMStateStore getRMStateStore(Configuration conf) throws Exception { String workingZnode = "/Test"; - conf.set(CommonConfigurationKeys.ZK_ADDRESS, + conf.set(YarnConfiguration.RM_ZK_ADDRESS, testingServer.getConnectString()); conf.set(YarnConfiguration.ZK_RM_STATE_STORE_PARENT_PATH, workingZnode); this.store = new TestZKRMStateStore(conf, workingZnode); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/TestZKConfigurationStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/TestZKConfigurationStore.java index 155996d11f..fa55b51a1b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/TestZKConfigurationStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf/TestZKConfigurationStore.java @@ -23,7 +23,6 @@ import org.apache.curator.retry.RetryNTimes; import org.apache.curator.test.TestingServer; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.ha.HAServiceProtocol; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.service.Service; @@ -100,7 +99,7 @@ public void setUp() throws Exception { curatorTestingServer = setupCuratorServer(); curatorFramework = setupCuratorFramework(curatorTestingServer); - conf.set(CommonConfigurationKeys.ZK_ADDRESS, + conf.set(YarnConfiguration.RM_ZK_ADDRESS, curatorTestingServer.getConnectString()); rm = new MockRM(conf); rm.start(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/Federation.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/Federation.md index 5702f8d165..3886f54041 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/Federation.md +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/Federation.md @@ -177,7 +177,7 @@ ZooKeeper: one must set the ZooKeeper settings for Hadoop: | Property | Example | Description | |:------------------------------------|:------------------------------------------------------------------------------------|:----------------------------------------| | `yarn.federation.state-store.class` | `org.apache.hadoop.yarn.server.federation.store.impl.ZookeeperFederationStateStore` | The type of state-store to use. | -| `hadoop.zk.address` | `host:port` | The address for the ZooKeeper ensemble. | +| `yarn.federation.state-store.zk.address` | `host:port` | The address for the ZooKeeper ensemble. | SQL: one must setup the following parameters: @@ -1006,7 +1006,7 @@ Example of Machine-Role Mapping(Exclude HDFS): - hadoop.zk.address + yarn.federation.state-store.zk.address zkHost:zkPort @@ -1067,7 +1067,7 @@ $HADOOP_HOME/bin/yarn --daemon start resourcemanager - hadoop.zk.address + yarn.federation.state-store.zk.address zkHost:zkPort @@ -1135,7 +1135,7 @@ After we have finished configuring the `YARN-2` cluster, we can proceed with sta - hadoop.zk.address + yarn.federation.state-store.zk.address zkHost:zkPort diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerHA.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerHA.md index 83b2af2ef9..636077e00c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerHA.md +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerHA.md @@ -56,7 +56,7 @@ Most of the failover functionality is tunable using various configuration proper | Configuration Properties | Description | |:---- |:---- | -| `hadoop.zk.address` | Address of the ZK-quorum. Used both for the state-store and embedded leader-election. | +| `yarn.resourcemanager.zk-address` | Address of the ZK-quorum. Used both for the state-store and embedded leader-election. | | `yarn.resourcemanager.ha.enabled` | Enable RM HA. | | `yarn.resourcemanager.ha.rm-ids` | List of logical IDs for the RMs. e.g., "rm1,rm2". | | `yarn.resourcemanager.hostname.`*rm-id* | For each *rm-id*, specify the hostname the RM corresponds to. Alternately, one could set each of the RM's service addresses. | @@ -112,7 +112,7 @@ Here is the sample of minimal setup for RM failover. master2:8088 - hadoop.zk.address + yarn.resourcemanager.zk-address zk1:2181,zk2:2181,zk3:2181 ``` diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRestart.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRestart.md index 68e44e98cb..428d48e680 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRestart.md +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRestart.md @@ -93,7 +93,7 @@ This section describes the configurations involved to enable RM Restart feature. | Property | Description | |:---- |:---- | -| `hadoop.zk.address` | Comma separated list of Host:Port pairs. Each corresponds to a ZooKeeper server (e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002") to be used by the RM for storing RM state. | +| `yarn.resourcemanager.zk-address` | Comma separated list of Host:Port pairs. Each corresponds to a ZooKeeper server (e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002") to be used by the RM for storing RM state. | | `yarn.resourcemanager.zk-state-store.parent-path` | The full path of the root znode where RM state will be stored. Default value is /rmstore. | * Configure the retry policy state-store client uses to connect with the ZooKeeper server. @@ -157,7 +157,7 @@ Below is a minimum set of configurations for enabling RM work-preserving restart (e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002") to be used by the RM for storing RM state. This must be supplied when using org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore as the value for yarn.resourcemanager.store.class - hadoop.zk.address + yarn.resourcemanager.zk-address 127.0.0.1:2181