Repository: ambari Updated Branches: refs/heads/trunk e10d40208 -> 9c086c303
AMBARI-13758 Zookeeper quorum hosts for AMS should point to localhost for distributed mode. (Aravindan Vijayan via dsen) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9c086c30 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9c086c30 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9c086c30 Branch: refs/heads/trunk Commit: 9c086c303fb6f772d2fb5d654b6bf7de2225ca62 Parents: e10d402 Author: Dmytro Sen <d...@apache.org> Authored: Mon Nov 9 20:47:13 2015 +0200 Committer: Dmytro Sen <d...@apache.org> Committed: Mon Nov 9 20:47:40 2015 +0200 ---------------------------------------------------------------------- .../internal/AbstractProviderModule.java | 38 +++++++++++++++++++- .../0.1.0/package/scripts/params.py | 2 +- 2 files changed, 38 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9c086c30/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java index 3ac64e3..2ef0a8e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java @@ -95,6 +95,7 @@ public abstract class AbstractProviderModule implements ProviderModule, private static final String PROPERTY_HDFS_HTTP_POLICY_VALUE_HTTPS_ONLY = "HTTPS_ONLY"; private static final String COLLECTOR_DEFAULT_PORT = "6188"; + private static boolean vipHostConfigPresent = false; private static final Map<String, Map<String, String[]>> jmxDesiredProperties = new HashMap<String, Map<String, String[]>>(); private volatile Map<String, String> clusterHdfsSiteConfigVersionMap = new HashMap<String, String>(); @@ -290,6 +291,7 @@ public abstract class AbstractProviderModule implements ProviderModule, String currentConfigVersion = getDesiredConfigVersion(clusterName, configType); String oldConfigVersion = serviceConfigVersions.get(configType); if (!currentConfigVersion.equals(oldConfigVersion)) { + vipHostConfigPresent = false; serviceConfigVersions.put(configType, currentConfigVersion); Map<String, String> configProperties = getDesiredConfigMap (clusterName, currentConfigVersion, configType, @@ -300,6 +302,7 @@ public abstract class AbstractProviderModule implements ProviderModule, clusterMetricserverVipHost = configProperties.get("METRICS_COLLECTOR"); if (clusterMetricserverVipHost != null) { clusterMetricCollectorMap.put(clusterName, clusterMetricserverVipHost); + vipHostConfigPresent = true; } } // updating the port value, because both vip properties are stored in @@ -316,6 +319,26 @@ public abstract class AbstractProviderModule implements ProviderModule, } catch (NoSuchParentResourceException | UnsupportedPropertyException e) { LOG.warn("Failed to retrieve collector hostname.", e); } + + //If vip config not present + // If current collector host is null or if the host or the host component not live + // Update clusterMetricCollectorMap with a live metric collector host. + if (!vipHostConfigPresent) { + String currentCollectorHost = clusterMetricCollectorMap.get(clusterName); + if(! (isHostLive(clusterName, currentCollectorHost) && + isHostComponentLive(clusterName, currentCollectorHost, "AMBARI_METRICS", Role.METRICS_COLLECTOR.name())) ) { + for (String hostname : metricServerHosts) { + if (isHostLive(clusterName, hostname) + && isHostComponentLive(clusterName, hostname, "AMBARI_METRICS", Role.METRICS_COLLECTOR.name())) { + clusterMetricCollectorMap.put(clusterName, hostname); + LOG.debug("New Metrics Collector Host : " + hostname); + break; + } else { + LOG.debug("Metrics Collector Host or host component not live : " + hostname); + } + } + } + } return clusterMetricCollectorMap.get(clusterName); } @@ -767,7 +790,20 @@ public abstract class AbstractProviderModule implements ProviderModule, clusterGangliaCollectorMap.put(clusterName, hostName); } if (componentName.equals(METRIC_SERVER)) { - clusterMetricCollectorMap.put(clusterName, hostName); + //If vip config not present + // If current collector host is null or if the host or the host component not live + // Update clusterMetricCollectorMap. + if (!vipHostConfigPresent) { + String currentCollectorHost = clusterMetricCollectorMap.get(clusterName); + LOG.debug("Current Metrics collector Host : " + currentCollectorHost); + if ((currentCollectorHost == null) || + !(isHostLive(clusterName, currentCollectorHost) && + isHostComponentLive(clusterName, currentCollectorHost, "AMBARI_METRICS", Role.METRICS_COLLECTOR.name())) + ) { + LOG.debug("New Metrics collector Host : " + hostName); + clusterMetricCollectorMap.put(clusterName, hostName); + } + } metricServerHosts.add(hostName); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/9c086c30/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py index ae7ccf8..1c6a49f 100644 --- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py @@ -115,7 +115,7 @@ else: max_open_files_limit = default("/configurations/ams-hbase-env/max_open_files_limit", "32768") -zookeeper_quorum_hosts = ','.join(ams_collector_hosts) if is_hbase_distributed else 'localhost' +zookeeper_quorum_hosts = 'localhost' ams_checkpoint_dir = config['configurations']['ams-site']['timeline.metrics.aggregator.checkpoint.dir'] hbase_pid_dir = status_params.hbase_pid_dir