Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZEPPELIN-6143] Add Interpreter Event Server Port configuration option #4893

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conf/zeppelin-env.sh.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# export ZEPPELIN_SSL_PORT # ssl port (used when ssl environment variable is set to true)
# export ZEPPELIN_JMX_ENABLE # Enable JMX feature by defining "true"
# export ZEPPELIN_JMX_PORT # Port number which JMX uses. If not set, JMX won't be enabled
# export ZEPPELIN_SERVER_RPC_PORT # Port for the Zeppelin Interpreter Event Server. If not set, an available port will be used automatically.

# export ZEPPELIN_LOG_DIR # Where log files are stored. PWD by default.
# export ZEPPELIN_PID_DIR # The pid files are stored. ${ZEPPELIN_HOME}/run by default.
Expand Down
6 changes: 6 additions & 0 deletions conf/zeppelin-site.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
<description>Context Path of the Web Application</description>
</property>

<property>
<name>zeppelin.server.rpc.port</name>
<value></value>
<description>Port for the Zeppelin Interpreter Event Server. If not set, an available port will be used automatically.</description>
</property>

<property>
<name>zeppelin.war.tempdir</name>
<value>webapps</value>
Expand Down
27 changes: 27 additions & 0 deletions docs/setup/operation/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,33 @@ Sources descending by priority:
<td>8443</td>
<td>Zeppelin Server ssl port (used when ssl environment/property is set to true)</td>
</tr>
<tr>
<td><h6 class="properties">ZEPPELIN_SERVER_RPC_PORTRANGE</h6></td>
<td><h6 class="properties">zeppelin.server.rpc.portRange</h6></td>
<td>:</td>
<td>
Specifies the port range for the Zeppelin Interpreter Event Server.
<br />Format: <code>&lt;startPort&gt;:&lt;endPort&gt;</code>
<br />If the <code>&lt;startPort&gt;</code> is omitted, the range will begin at 1024. If the <code>&lt;endPort&gt;</code> is omitted, the range will extend up to 65535.
<br /><span style="font-style:italic; color: gray"> Note: If <code>zeppelin.server.rpc.port</code> is set, this property will be ignored.</span>
</td>
</tr>
<tr>
<td><h6 class="properties">ZEPPELIN_INTERPRETER_RPC_PORTRANGE</h6></td>
<td><h6 class="properties">zeppelin.interpreter.rpc.portRange</h6></td>
<td>:</td>
<td>
Specifies the port range for the Zeppelin Interpreter.
<br />Format: <code>&lt;startPort&gt;:&lt;endPort&gt;</code>
<br />If the <code>&lt;startPort&gt;</code> is omitted, the range will begin at 1024. If the <code>&lt;endPort&gt;</code> is omitted, the range will extend up to 65535.
</td>
</tr>
<tr>
<td><h6 class="properties">ZEPPELIN_SERVER_RPC_PORT</h6></td>
<td><h6 class="properties">zeppelin.server.rpc.port</h6></td>
<td></td>
<td>Port for the Zeppelin Interpreter Event Server. If not set, an available port will be used automatically.</td>
</tr>
<tr>
<td><h6 class="properties">ZEPPELIN_JMX_ENABLE</h6></td>
<td><h6 class="properties">zeppelin.jmx.enable</h6></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,14 @@ public int getServerPort() {
return getInt(ConfVars.ZEPPELIN_PORT);
}

public OptionalInt getZeppelinServerRpcPort() {
String zeppelinServerRpcPort = getString(ConfVars.ZEPPELIN_SERVER_RPC_PORT);
if (StringUtils.isBlank(zeppelinServerRpcPort)) {
return OptionalInt.empty();
}
return OptionalInt.of(Integer.parseInt(zeppelinServerRpcPort));
}

public String getServerContextPath() {
return getString(ConfVars.ZEPPELIN_SERVER_CONTEXT_PATH);
}
Expand Down Expand Up @@ -948,6 +956,7 @@ public enum ConfVars {
ZEPPELIN_SSL_TRUSTSTORE_PATH("zeppelin.ssl.truststore.path", null),
ZEPPELIN_SSL_TRUSTSTORE_TYPE("zeppelin.ssl.truststore.type", null),
ZEPPELIN_SSL_TRUSTSTORE_PASSWORD("zeppelin.ssl.truststore.password", null),
ZEPPELIN_SERVER_RPC_PORT("zeppelin.server.rpc.port", null),
ZEPPELIN_WAR("zeppelin.war", "zeppelin-web/dist"),
ZEPPELIN_ANGULAR_WAR("zeppelin.angular.war", "zeppelin-web-angular/dist/zeppelin"),
ZEPPELIN_WAR_TEMPDIR("zeppelin.war.tempdir", "webapps"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.util.OptionalInt;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.thrift.TException;
Expand Down Expand Up @@ -49,7 +50,6 @@
import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterResultMessage;
import org.apache.zeppelin.interpreter.thrift.RunParagraphsEvent;
import org.apache.zeppelin.interpreter.thrift.WebUrlInfo;
import org.apache.zeppelin.notebook.Note;
import org.apache.zeppelin.resource.RemoteResource;
import org.apache.zeppelin.resource.Resource;
import org.apache.zeppelin.resource.ResourceId;
Expand Down Expand Up @@ -78,7 +78,6 @@ public class RemoteInterpreterEventServer implements RemoteInterpreterEventServi
private static final Logger LOGGER = LoggerFactory.getLogger(RemoteInterpreterEventServer.class);
private static final Gson GSON = new Gson();

private String portRange;
private int port;
private String host;
private ZeppelinConfiguration zConf;
Expand All @@ -96,7 +95,6 @@ public class RemoteInterpreterEventServer implements RemoteInterpreterEventServi
public RemoteInterpreterEventServer(ZeppelinConfiguration zConf,
InterpreterSettingManager interpreterSettingManager) {
this.zConf = zConf;
this.portRange = zConf.getZeppelinServerRPCPortRange();
this.interpreterSettingManager = interpreterSettingManager;
this.listener = interpreterSettingManager.getRemoteInterpreterProcessListener();
this.appListener = interpreterSettingManager.getAppEventListener();
Expand All @@ -106,7 +104,9 @@ public void start() throws IOException {
Thread startingThread = new Thread() {
@Override
public void run() {
try (TServerSocket tSocket = new TServerSocket(RemoteInterpreterUtils.findAvailablePort(portRange))){
try (TServerSocket tSocket = new TServerSocket(zConf.getZeppelinServerRpcPort().orElse(
RemoteInterpreterUtils.findAvailablePort(zConf.getZeppelinServerRPCPortRange())))
) {
port = tSocket.getServerSocket().getLocalPort();
host = RemoteInterpreterUtils.findAvailableHostAddress();
LOGGER.info("InterpreterEventServer is starting at {}:{}", host, port);
Expand Down
Loading