You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by am...@apache.org on 2018/08/16 12:02:28 UTC
[ambari] branch branch-2.7 updated: AMBARI-24486. Yarn Timeline
Service V2 Reader is found down after EU (Atlantic to AtlanticM05) With
error - Address already in use (amagyar) (#2085) (#2090)
This is an automated email from the ASF dual-hosted git repository.
amagyar pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push:
new 591bdff AMBARI-24486. Yarn Timeline Service V2 Reader is found down after EU (Atlantic to AtlanticM05) With error - Address already in use (amagyar) (#2085) (#2090)
591bdff is described below
commit 591bdff6997d945df671c8bfcc13cc61c74bcc2d
Author: Attila Magyar <m....@gmail.com>
AuthorDate: Thu Aug 16 14:02:26 2018 +0200
AMBARI-24486. Yarn Timeline Service V2 Reader is found down after EU (Atlantic to AtlanticM05) With error - Address already in use (amagyar) (#2085) (#2090)
---
.../upgrades/FixTimelineReaderAddress.java | 25 ++++++++++++++++++----
.../upgrades/FixTimelineReaderAddressTest.java | 4 ++--
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixTimelineReaderAddress.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixTimelineReaderAddress.java
index c7ddaa8..e2f5613 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixTimelineReaderAddress.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixTimelineReaderAddress.java
@@ -49,9 +49,9 @@ public class FixTimelineReaderAddress extends AbstractUpgradeServerAction {
private static final Logger LOG = LoggerFactory.getLogger(CreateAndConfigureAction.class);
private static final String YARN_SITE = "yarn-site";
private static final String TIMELINE_READER = "TIMELINE_READER";
- private static final String[] HOST_PROPERTIES = new String[] {
- "yarn.timeline-service.reader.webapp.address",
- "yarn.timeline-service.reader.webapp.https.address"
+ private static final String HTTP_ADDRESS = "yarn.timeline-service.reader.webapp.address";
+ private static final String HTTPS_ADDRESS = "yarn.timeline-service.reader.webapp.https.address";
+ private static final String[] HOST_PROPERTIES = new String[] {HTTP_ADDRESS, HTTPS_ADDRESS
};
@Override
@@ -68,7 +68,7 @@ public class FixTimelineReaderAddress extends AbstractUpgradeServerAction {
if (oldHost == null) {
continue;
}
- String newHost = oldHost.replace("localhost", hostNameOf(cluster, "YARN", TIMELINE_READER));
+ String newHost = replace(oldHost, hostNameOf(cluster, "YARN", TIMELINE_READER), defaultPort(propertyName));
updatedHosts.add(newHost);
updateConfig(cluster, propertyName, newHost, config);
}
@@ -78,6 +78,23 @@ public class FixTimelineReaderAddress extends AbstractUpgradeServerAction {
}
}
+ private int defaultPort(String propertyName) {
+ switch (propertyName) {
+ case HTTP_ADDRESS: return 8198;
+ case HTTPS_ADDRESS: return 8199;
+ default: throw new IllegalArgumentException("Unknown property: " + propertyName);
+ }
+ }
+
+ private String replace(String oldHost, String newHost, int defaultPort) {
+ if (oldHost.contains(":")) {
+ String hostPart = oldHost.split(":")[0];
+ return oldHost.replace(hostPart, newHost);
+ } else {
+ return newHost + ":" + defaultPort;
+ }
+ }
+
private void updateConfig(Cluster cluster, String propertyName, String propertyValue, Config config) throws AmbariException {
Map<String, String> newProperties = new HashMap<>();
newProperties.put(propertyName, propertyValue);
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixTimelineReaderAddressTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixTimelineReaderAddressTest.java
index 14bd0f7..eb0b68e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixTimelineReaderAddressTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixTimelineReaderAddressTest.java
@@ -67,7 +67,7 @@ public class FixTimelineReaderAddressTest extends EasyMockSupport {
expect(cluster.getDesiredConfigByType("yarn-site")).andReturn(config).anyTimes();
expect(config.getProperties()).andReturn(new HashMap<String, String>() {{
put("yarn.timeline-service.reader.webapp.address", "localhost:8080");
- put("yarn.timeline-service.reader.webapp.https.address", "localhost:8081");
+ put("yarn.timeline-service.reader.webapp.https.address", "{{timeline_reader_address_https}}");
}}).anyTimes();
expect(yarn.getServiceComponent("TIMELINE_READER")).andReturn(timelineReader).anyTimes();
expect(timelineReader.getServiceComponentHosts()).andReturn(new HashMap<String, ServiceComponentHost>(){{
@@ -82,7 +82,7 @@ public class FixTimelineReaderAddressTest extends EasyMockSupport {
}});
expectLastCall();
config.updateProperties(new HashMap<String, String>() {{
- put("yarn.timeline-service.reader.webapp.https.address", "newhost:8081");
+ put("yarn.timeline-service.reader.webapp.https.address", "newhost:8199");
}});
expectLastCall();
replayAll();