Repository: ambari Updated Branches: refs/heads/trunk 43abcf0d7 -> fa8c51e41
AMBARI-8808. Resolve potential port conflicts with Hadoop daemons. ATS port fix. (swagle) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fa8c51e4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fa8c51e4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fa8c51e4 Branch: refs/heads/trunk Commit: fa8c51e41990664db274643f8113c490dd5c17b4 Parents: 43abcf0 Author: Siddharth Wagle <[email protected]> Authored: Fri Dec 19 14:44:07 2014 -0800 Committer: Siddharth Wagle <[email protected]> Committed: Fri Dec 19 14:44:07 2014 -0800 ---------------------------------------------------------------------- .../ApplicationHistoryClientService.java | 14 +++++++++++--- .../ApplicationHistoryServer.java | 5 ++--- .../metrics/timeline/TimelineMetricConfiguration.java | 11 +++++++++++ .../controller/internal/AbstractProviderModule.java | 14 +++++--------- .../AMS/0.1.0/configuration/ams-site.xml | 7 +++++++ .../AMS/0.1.0/package/templates/metric_monitor.ini.j2 | 2 +- 6 files changed, 37 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/fa8c51e4/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java index e15198b..8a37a57 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java @@ -27,6 +27,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.ipc.Server; +import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol; import org.apache.hadoop.yarn.api.protocolrecords.CancelDelegationTokenRequest; @@ -57,6 +58,7 @@ import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.ipc.YarnRPC; +import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricConfiguration; public class ApplicationHistoryClientService extends AbstractService { private static final Log LOG = LogFactory @@ -65,6 +67,7 @@ public class ApplicationHistoryClientService extends AbstractService { private ApplicationHistoryProtocol protocolHandler; private Server server; private InetSocketAddress bindAddress; + private TimelineMetricConfiguration metricConfiguration; public ApplicationHistoryClientService(ApplicationHistoryManager history) { super("ApplicationHistoryClientService"); @@ -72,13 +75,18 @@ public class ApplicationHistoryClientService extends AbstractService { this.protocolHandler = new ApplicationHSClientProtocolHandler(); } + public ApplicationHistoryClientService(ApplicationHistoryManager history, + TimelineMetricConfiguration metricConfiguration) { + this(history); + this.metricConfiguration = metricConfiguration; + } + protected void serviceStart() throws Exception { Configuration conf = getConfig(); YarnRPC rpc = YarnRPC.create(conf); InetSocketAddress address = - conf.getSocketAddr(YarnConfiguration.TIMELINE_SERVICE_ADDRESS, - YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ADDRESS, - YarnConfiguration.DEFAULT_TIMELINE_SERVICE_PORT); + NetUtils.createSocketAddr(metricConfiguration.getTimelineServiceRpcAddress(), + YarnConfiguration.DEFAULT_TIMELINE_SERVICE_PORT); server = rpc.getServer(ApplicationHistoryProtocol.class, protocolHandler, http://git-wip-us.apache.org/repos/asf/ambari/blob/fa8c51e4/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java index 131636d..3dd4d8d 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java @@ -109,10 +109,9 @@ public class ApplicationHistoryServer extends CompositeService { return this.ahsClientService; } - protected ApplicationHistoryClientService - createApplicationHistoryClientService( + protected ApplicationHistoryClientService createApplicationHistoryClientService( ApplicationHistoryManager historyManager) { - return new ApplicationHistoryClientService(historyManager); + return new ApplicationHistoryClientService(historyManager, metricConfiguration); } protected ApplicationHistoryManager createApplicationHistory() { http://git-wip-us.apache.org/repos/asf/ambari/blob/fa8c51e4/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricConfiguration.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricConfiguration.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricConfiguration.java index 0e9abf7..e1275c8 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricConfiguration.java +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/TimelineMetricConfiguration.java @@ -125,6 +125,9 @@ public class TimelineMetricConfiguration { public static final String WEBAPP_HTTP_ADDRESS = "timeline.metrics.service.webapp.address"; + public static final String TIMELINE_SERVICE_RPC_ADDRESS = + "timeline.metrics.service.rpc.address"; + private Configuration hbaseConf; private Configuration metricsConf; private volatile boolean isInitialized = false; @@ -177,4 +180,12 @@ public class TimelineMetricConfiguration { } return defaultHttpAddress; } + + public String getTimelineServiceRpcAddress() { + String defaultHttpAddress = "0.0.0.0:60200"; + if (metricsConf != null) { + return metricsConf.get(TIMELINE_SERVICE_RPC_ADDRESS, defaultHttpAddress); + } + return defaultHttpAddress; + } } http://git-wip-us.apache.org/repos/asf/ambari/blob/fa8c51e4/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 dde24c2..bf68986 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 @@ -98,7 +98,7 @@ public abstract class AbstractProviderModule implements ProviderModule, private static final Map<String, Map<String, String[]>> jmxDesiredProperties = new HashMap<String, Map<String, String[]>>(); private volatile Map<String, String> clusterCoreSiteConfigVersionMap = new HashMap<String, String>(); private volatile Map<String, String> clusterJmxProtocolMap = new HashMap<String, String>(); - private volatile String clusterMetricServerPort = "80"; + private volatile String clusterMetricServerPort = null; static { serviceConfigTypes.put(Service.Type.HDFS, "hdfs-site"); @@ -335,7 +335,6 @@ public abstract class AbstractProviderModule implements ProviderModule, if (service.equals(GANGLIA)) { return "80"; // Not called by the provider } else if (service.equals(TIMELINE_METRICS)) { - String collectorPort = null; try { String configType = serviceConfigTypes.get(Service.Type.AMS); String currentConfigVersion = getDesiredConfigVersion(clusterName, configType); @@ -347,10 +346,12 @@ public abstract class AbstractProviderModule implements ProviderModule, Map<String, String> configProperties = getDesiredConfigMap (clusterName, currentConfigVersion, configType, Collections.singletonMap("METRIC_COLLECTOR", - new String[]{"timeline.metrics.service.webapp.address"})); + new String[] { "timeline.metrics.service.webapp.address" })); if (!configProperties.isEmpty()) { - collectorPort = getPortString(configProperties.get("METRIC_COLLECTOR")); + clusterMetricServerPort = getPortString(configProperties.get("METRIC_COLLECTOR")); + } else { + clusterMetricServerPort = "8188"; } } @@ -359,11 +360,6 @@ public abstract class AbstractProviderModule implements ProviderModule, } catch (UnsupportedPropertyException e) { LOG.warn("Failed to retrieve collector port.", e); } - if (collectorPort == null) { - return "8188"; - } else { - clusterMetricServerPort = collectorPort; - } } return clusterMetricServerPort; } http://git-wip-us.apache.org/repos/asf/ambari/blob/fa8c51e4/ambari-server/src/main/resources/common-services/AMS/0.1.0/configuration/ams-site.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMS/0.1.0/configuration/ams-site.xml b/ambari-server/src/main/resources/common-services/AMS/0.1.0/configuration/ams-site.xml index 84b075b..2f8281a 100644 --- a/ambari-server/src/main/resources/common-services/AMS/0.1.0/configuration/ams-site.xml +++ b/ambari-server/src/main/resources/common-services/AMS/0.1.0/configuration/ams-site.xml @@ -39,6 +39,13 @@ </description> </property> <property> + <name>timeline.metrics.service.rpc.address</name> + <value>0.0.0.0:60200</value> + <description> + The address of the metrics service rpc listeners. + </description> + </property> + <property> <name>timeline.metrics.aggregator.checkpoint.dir</name> <value>/tmp</value> <description> http://git-wip-us.apache.org/repos/asf/ambari/blob/fa8c51e4/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_monitor.ini.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_monitor.ini.j2 b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_monitor.ini.j2 index 5e672fc..2ee21d4 100644 --- a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_monitor.ini.j2 +++ b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_monitor.ini.j2 @@ -18,7 +18,7 @@ [default] debug_level = INFO -metrics_server = {{ams_collector_host_single}}:{{ams_collector_port}} +metrics_server = {{ams_collector_host_single}}:{{metric_collector_port}} enable_time_threshold = false enable_value_threshold = false
