|
@@ -58,6 +58,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* Class on the NodeManager side that manages adding and removing collectors and
|
|
|
* their lifecycle. Also instantiates the per-node collector webapp.
|
|
@@ -280,14 +281,21 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
|
|
|
String bindAddress = null;
|
|
|
String host =
|
|
|
conf.getTrimmed(YarnConfiguration.TIMELINE_SERVICE_COLLECTOR_BIND_HOST);
|
|
|
+ Configuration.IntegerRanges portRanges = conf.getRange(
|
|
|
+ YarnConfiguration.TIMELINE_SERVICE_COLLECTOR_BIND_PORT_RANGES, "");
|
|
|
+ int startPort = 0;
|
|
|
+ if (portRanges != null && !portRanges.isEmpty()) {
|
|
|
+ startPort = portRanges.getRangeStart();
|
|
|
+ }
|
|
|
if (host == null || host.isEmpty()) {
|
|
|
// if collector bind-host is not set, fall back to
|
|
|
// timeline-service.bind-host to maintain compatibility
|
|
|
bindAddress =
|
|
|
conf.get(YarnConfiguration.DEFAULT_TIMELINE_SERVICE_BIND_HOST,
|
|
|
- YarnConfiguration.DEFAULT_TIMELINE_SERVICE_BIND_HOST) + ":0";
|
|
|
+ YarnConfiguration.DEFAULT_TIMELINE_SERVICE_BIND_HOST)
|
|
|
+ + ":" + startPort;
|
|
|
} else {
|
|
|
- bindAddress = host + ":0";
|
|
|
+ bindAddress = host + ":" + startPort;
|
|
|
}
|
|
|
|
|
|
try {
|
|
@@ -297,6 +305,9 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
|
|
|
.addEndpoint(URI.create(
|
|
|
(YarnConfiguration.useHttps(conf) ? "https://" : "http://") +
|
|
|
bindAddress));
|
|
|
+ if (portRanges != null && !portRanges.isEmpty()) {
|
|
|
+ builder.setPortRanges(portRanges);
|
|
|
+ }
|
|
|
if (YarnConfiguration.useHttps(conf)) {
|
|
|
builder = WebAppUtils.loadSslConfiguration(builder, conf);
|
|
|
}
|