ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlun...@apache.org
Subject ambari git commit: AMBARI-14312: Express Upgrade: Failure during restart of all Node Managers during EU from 2.1 to 2.3.4 with timeout error (jluniya)
Date Thu, 10 Dec 2015 03:28:26 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 1cec631d6 -> 9a0013575


AMBARI-14312: Express Upgrade: Failure during restart of all Node Managers during EU from
2.1 to 2.3.4 with timeout error (jluniya)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9a001357
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9a001357
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9a001357

Branch: refs/heads/branch-2.2
Commit: 9a0013575b035d9b77814fc6314cf97544790671
Parents: 1cec631
Author: Jayush Luniya <jluniya@hortonworks.com>
Authored: Wed Dec 9 19:27:31 2015 -0800
Committer: Jayush Luniya <jluniya@hortonworks.com>
Committed: Wed Dec 9 19:28:21 2015 -0800

----------------------------------------------------------------------
 .../upgrades/YarnConfigCalculation.java         | 102 +++++++++++++++++++
 .../HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml |   3 +
 2 files changed, 105 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9a001357/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/YarnConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/YarnConfigCalculation.java
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/YarnConfigCalculation.java
new file mode 100644
index 0000000..5953553
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/YarnConfigCalculation.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.serveraction.upgrades;
+
+import com.google.inject.Inject;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.Role;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.serveraction.AbstractServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.ServiceComponentHost;
+import org.apache.commons.lang.StringUtils;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * Computes Yarn properties.  This class is only used when moving from
+ * HDP-2.1 to HDP-2.3 in that upgrade pack.
+ */
+public class YarnConfigCalculation extends AbstractServerAction {
+  private static final String YARN_SITE_CONFIG_TYPE = "yarn-site";
+  private static final String ZOO_CFG_CONFIG_TYPE = "zoo.cfg";
+  private static final String YARN_RM_ZK_ADDRESS_PROPERTY_NAME = "yarn.resourcemanager.zk-address";
+  private static final String HADOOP_REGISTRY_ZK_QUORUM_PROPERTY_NAME = "hadoop.registry.zk.quorum";
+  private static final String ZOOKEEPER_CLIENT_PORT_PROPERTY_NAME = "clientPort";
+  private static final String DEFAULT_ZK_CLIENT_PORT = "2181";
+
+  @Inject
+  private Clusters clusters;
+
+  @Override
+  public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
+      throws AmbariException, InterruptedException {
+
+    String clusterName = getExecutionCommand().getClusterName();
+
+    Cluster cluster = clusters.getCluster(clusterName);
+
+    Config yarnSiteConfig = cluster.getDesiredConfigByType(YARN_SITE_CONFIG_TYPE);
+
+    if (yarnSiteConfig == null) {
+      return  createCommandReport(0, HostRoleStatus.FAILED,"{}",
+          String.format("Source type %s not found", YARN_SITE_CONFIG_TYPE), "");
+    }
+
+    Map<String, String> yarnSiteProperties = yarnSiteConfig.getProperties();
+    String oldRmZkAddress = yarnSiteProperties.get(YARN_RM_ZK_ADDRESS_PROPERTY_NAME);
+    String oldHadoopRegistryZKQuorum = yarnSiteProperties.get(HADOOP_REGISTRY_ZK_QUORUM_PROPERTY_NAME);
+
+    String zkClientPort = DEFAULT_ZK_CLIENT_PORT;
+    Config zooConfig = cluster.getDesiredConfigByType(ZOO_CFG_CONFIG_TYPE);
+    if(zooConfig != null) {
+      Map<String, String> zooProperties = zooConfig.getProperties();
+      if(zooProperties.containsKey(ZOOKEEPER_CLIENT_PORT_PROPERTY_NAME)) {
+        zkClientPort = zooProperties.get(ZOOKEEPER_CLIENT_PORT_PROPERTY_NAME);
+      }
+    }
+
+    List<ServiceComponentHost> zkServers = cluster.getServiceComponentHosts(
+        Service.Type.ZOOKEEPER.name(), Role.ZOOKEEPER_SERVER.name());
+
+    List<String> zkAddresses = new ArrayList<>();
+    for(ServiceComponentHost zkServer : zkServers) {
+      String zkAddress = zkServer.getHostName() + ":" + zkClientPort;
+      zkAddresses.add(zkAddress);
+    }
+    String zkServersStr = StringUtils.join(zkAddresses, ",");
+    yarnSiteProperties.put(YARN_RM_ZK_ADDRESS_PROPERTY_NAME, zkServersStr);
+    yarnSiteProperties.put(HADOOP_REGISTRY_ZK_QUORUM_PROPERTY_NAME, zkServersStr);
+    yarnSiteConfig.setProperties(yarnSiteProperties);
+    yarnSiteConfig.persist(false);
+
+    return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+        String.format("%s was set from %s to %s. %s was set from %s to %s",
+            YARN_RM_ZK_ADDRESS_PROPERTY_NAME, oldRmZkAddress, zkServersStr,
+            HADOOP_REGISTRY_ZK_QUORUM_PROPERTY_NAME, oldHadoopRegistryZKQuorum, zkServersStr),
"");
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/9a001357/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml
b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml
index b901cd5..015284d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml
@@ -263,6 +263,9 @@
         <task xsi:type="configure" id="hdp_2_3_0_0_yarn_rm_check_cs_root_max_capacity"/>
       </execute-stage>
 
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Calculating Yarn
Properties">
+        <task xsi:type="server_action" summary="Calculating Yarn Properties" class="org.apache.ambari.server.serveraction.upgrades.YarnConfigCalculation"
/>
+      </execute-stage>
 
       <!--HBASE-->
       <execute-stage service="HBASE" component="HBASE_MASTER" title="Apply config changes
for HBase Master">


Mime
View raw message