I think I've resolved the issue on my cluster with the attached patch. I'm
still testing it, but, so far so good. I just wanted to get this out there
for now in case others are having similar issues.
Hopefully the diff doesn't get stripped. Essentially, I tacked oneway and
twoway SSL port configuration to the Builder class in AgentWebApp
Then, I used getPortToRequest() to pull a port from the pool of predefined
ports when creating the App (in SliderAppMaster).
Tim
On Thu, Mar 3, 2016 at 3:32 PM, Tim I <[email protected]> wrote:
> Hi all,
>
> Our use case is to run apps on slider in an environment where all no
> registered ports (or ranges of ports) need to be firewalled off.
>
> I'm getting some issues when my appmaster runs on a different node than
> the agent. It appears to be due to the following ports (specifically the
> oneway port):
>
> }; internal endpoints: {{
> "api" : "classpath:org.apache.slider.agents.secure",
> "addressType" : "uri",
> "protocolType" : "REST",
> "addresses" : [ {
> "uri" : "https://node03.domain.com:54673/ws/v1/slider/agents"
> } ]
> }; {
> "api" : "classpath:org.apache.slider.agents.oneway",
> "addressType" : "uri",
> "protocolType" : "REST",
> "addresses" : [ {
> "uri" : "https://node03.domain.com:42728/ws/v1/slider/agents"
> } ]
>
>
> The error from the agent container is:
>
>> INFO 2016-03-03 20:06:37,358 NetUtil.py:38 - Connecting to the following
>> url https://node03.domain.com:42728/ws/v1/slider/agents/
>> INFO 2016-03-03 20:07:40,359 NetUtil.py:57 - Failed to connect to
>> https://node03.domain.com:42728/ws/v1/slider/agents/ due to [Errno 110]
>> Connection timed out
>> INFO 2016-03-03 20:07:40,359 NetUtil.py:76 - Server at
>> https://node03.domain.com:42728/ws/v1/slider/agents/ is not reachable,
>> sleeping for 10 seconds...
>>
>
>
> A few of questions:
> 1. Is it possible to set this port?
> 2. Is it possible to set this port per application?
> 3. Is it possible to set this to a range of ports (like the
> ALLOCATED_PORT)?
>
> Thanks,
>
> Tim
>
diff --git
a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index 019ec71..af37502 100644
---
a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++
b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -1127,7 +1127,7 @@ public class SliderAppMaster extends
AbstractSliderLaunchedService
* @throws IOException
*/
private void startAgentWebApp(MapOperations appInformation,
- Configuration serviceConf, WebAppApiImpl webAppApi) throws IOException {
+ Configuration serviceConf, WebAppApiImpl webAppApi) throws IOException,
SliderException {
URL[] urls = ((URLClassLoader) AgentWebApp.class.getClassLoader()
).getURLs();
StringBuilder sb = new StringBuilder("AM classpath:");
for (URL url : urls) {
@@ -1144,7 +1144,9 @@ public class SliderAppMaster extends
AbstractSliderLaunchedService
webAppApi,
RestPaths.AGENT_WS_CONTEXT)
.withComponentConfig(appMasterConfig)
- .start();
+ .withPort(getPortToRequest())
+ .withSecuredPort(getPortToRequest())
+ .start();
agentOpsUrl =
"https://" + appMasterHostname + ":" + agentWebApp.getSecuredPort();
agentStatusUrl =
diff --git
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebApp.java
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebApp.java
index f9ea06d..200fbc2 100644
---
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebApp.java
+++
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebApp.java
@@ -56,6 +56,8 @@ public class AgentWebApp implements Closeable {
final String name;
final String wsName;
final WebAppApi application;
+ int port;
+ int securedPort;
MapOperations configsMap;
public Builder(String name, String wsName, WebAppApi application) {
@@ -69,6 +71,16 @@ public class AgentWebApp implements Closeable {
return this;
}
+ public Builder withPort (int port) {
+ this.port = port;
+ return this;
+ }
+
+ public Builder withSecuredPort (int securedPort) {
+ this.securedPort = securedPort;
+ return this;
+ }
+
public AgentWebApp start() throws IOException {
if (configsMap == null) {
throw new IllegalStateException("No SSL Configuration Available");
@@ -80,11 +92,11 @@ public class AgentWebApp implements Closeable {
configsMap.getOptionInt("agent.threadpool.size.max", 25)));
agentServer.setStopAtShutdown(true);
- SslSelectChannelConnector ssl1WayConnector = createSSLConnector(false);
+ SslSelectChannelConnector ssl1WayConnector = createSSLConnector(false,
port);
SslSelectChannelConnector ssl2WayConnector =
createSSLConnector(Boolean.valueOf(
configsMap.getOption(AgentKeys.KEY_AGENT_TWO_WAY_SSL_ENABLED,
- "false")));
+ "false")), securedPort);
agentServer.setConnectors(new Connector[]{ssl1WayConnector,
ssl2WayConnector});
@@ -119,7 +131,7 @@ public class AgentWebApp implements Closeable {
}
- private SslSelectChannelConnector createSSLConnector(boolean
needClientAuth) {
+ private SslSelectChannelConnector createSSLConnector(boolean
needClientAuth, int port) {
SslSelectChannelConnector sslConnector = new
SslSelectChannelConnector();
@@ -135,6 +147,7 @@ public class AgentWebApp implements Closeable {
sslConnector.setTruststoreType("PKCS12");
sslConnector.setNeedClientAuth(needClientAuth);
+ sslConnector.setPort(port);
sslConnector.setAcceptors(2);
return sslConnector;
}