From 1c78dc870a51ecb997b1a51d314c3a628751f995 Mon Sep 17 00:00:00 2001 From: Chan Ho Lee Date: Mon, 4 Nov 2024 00:48:37 +0900 Subject: [PATCH 1/5] Add ZEPPELIN_EVENT_SERVER_PORT option --- conf/zeppelin-env.sh.template | 1 + conf/zeppelin-site.xml.template | 6 ++++++ docs/setup/operation/configuration.md | 6 ++++++ .../org/apache/zeppelin/conf/ZeppelinConfiguration.java | 9 +++++++++ .../interpreter/RemoteInterpreterEventServer.java | 4 +++- 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/conf/zeppelin-env.sh.template b/conf/zeppelin-env.sh.template index 755849f053b..a1a17fdc307 100644 --- a/conf/zeppelin-env.sh.template +++ b/conf/zeppelin-env.sh.template @@ -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_EVENT_SERVER_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. diff --git a/conf/zeppelin-site.xml.template b/conf/zeppelin-site.xml.template index 91b7a150290..e94d70e9aa6 100755 --- a/conf/zeppelin-site.xml.template +++ b/conf/zeppelin-site.xml.template @@ -43,6 +43,12 @@ Context Path of the Web Application + + zeppelin.event.server.port + + Port for the Zeppelin Interpreter Event Server. If not set, an available port will be used automatically. + + zeppelin.war.tempdir webapps diff --git a/docs/setup/operation/configuration.md b/docs/setup/operation/configuration.md index a2184314d20..f9146b4631a 100644 --- a/docs/setup/operation/configuration.md +++ b/docs/setup/operation/configuration.md @@ -60,6 +60,12 @@ Sources descending by priority:
zeppelin.server.ssl.port
8443 Zeppelin Server ssl port (used when ssl environment/property is set to true) + +
ZEPPELIN_EVENT_SERVER_PORT
+
zeppelin.event.server.port
+ + Port for the Zeppelin Interpreter Event Server. If not set, an available port will be used automatically. +
ZEPPELIN_JMX_ENABLE
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java index b590fa8dda5..8d811ad4a7f 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java @@ -338,6 +338,14 @@ public int getServerPort() { return getInt(ConfVars.ZEPPELIN_PORT); } + public OptionalInt getEventServerPort() { + String eventServerPort = getString(ConfVars.ZEPPELIN_EVENT_SERVER_PORT); + if (StringUtils.isBlank(eventServerPort)) { + return OptionalInt.empty(); + } + return OptionalInt.of(Integer.parseInt(eventServerPort)); + } + public String getServerContextPath() { return getString(ConfVars.ZEPPELIN_SERVER_CONTEXT_PATH); } @@ -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_EVENT_SERVER_PORT("zeppelin.event.server.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"), diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java index d2649ab226e..71b5430a4b8 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java @@ -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; @@ -103,10 +104,11 @@ public RemoteInterpreterEventServer(ZeppelinConfiguration zConf, } public void start() throws IOException { + final OptionalInt portOpt = zConf.getEventServerPort(); Thread startingThread = new Thread() { @Override public void run() { - try (TServerSocket tSocket = new TServerSocket(RemoteInterpreterUtils.findAvailablePort(portRange))){ + try (TServerSocket tSocket = new TServerSocket(portOpt.orElse(RemoteInterpreterUtils.findAvailablePort(portRange)))) { port = tSocket.getServerSocket().getLocalPort(); host = RemoteInterpreterUtils.findAvailableHostAddress(); LOGGER.info("InterpreterEventServer is starting at {}:{}", host, port); From 83c8af4473cb645081e4bfba50b3702b70521094 Mon Sep 17 00:00:00 2001 From: Chan Ho Lee Date: Mon, 11 Nov 2024 19:54:34 +0900 Subject: [PATCH 2/5] Change ZEPPELIN_EVENT_SERVER_PORT to ZEPPELIN_RPC_SERVER_PORT --- conf/zeppelin-env.sh.template | 2 +- conf/zeppelin-site.xml.template | 2 +- docs/setup/operation/configuration.md | 4 ++-- .../apache/zeppelin/conf/ZeppelinConfiguration.java | 10 +++++----- .../interpreter/RemoteInterpreterEventServer.java | 3 +-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/conf/zeppelin-env.sh.template b/conf/zeppelin-env.sh.template index a1a17fdc307..e8160b563c9 100644 --- a/conf/zeppelin-env.sh.template +++ b/conf/zeppelin-env.sh.template @@ -29,7 +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_EVENT_SERVER_PORT # Port for the Zeppelin Interpreter Event Server. If not set, an available port will be used automatically. +# 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. diff --git a/conf/zeppelin-site.xml.template b/conf/zeppelin-site.xml.template index e94d70e9aa6..24218ce67a4 100755 --- a/conf/zeppelin-site.xml.template +++ b/conf/zeppelin-site.xml.template @@ -44,7 +44,7 @@
- zeppelin.event.server.port + zeppelin.server.rpc.port Port for the Zeppelin Interpreter Event Server. If not set, an available port will be used automatically. diff --git a/docs/setup/operation/configuration.md b/docs/setup/operation/configuration.md index f9146b4631a..af621e105c6 100644 --- a/docs/setup/operation/configuration.md +++ b/docs/setup/operation/configuration.md @@ -61,8 +61,8 @@ Sources descending by priority: 8443 Zeppelin Server ssl port (used when ssl environment/property is set to true) -
ZEPPELIN_EVENT_SERVER_PORT
-
zeppelin.event.server.port
+
ZEPPELIN_SERVER_RPC_PORT
+
zeppelin.server.rpc.port
Port for the Zeppelin Interpreter Event Server. If not set, an available port will be used automatically. diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java index 8d811ad4a7f..3b9ebee0bad 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java @@ -338,12 +338,12 @@ public int getServerPort() { return getInt(ConfVars.ZEPPELIN_PORT); } - public OptionalInt getEventServerPort() { - String eventServerPort = getString(ConfVars.ZEPPELIN_EVENT_SERVER_PORT); - if (StringUtils.isBlank(eventServerPort)) { + public OptionalInt getZeppelinServerRpcPort() { + String zeppelinServerRpcPort = getString(ConfVars.ZEPPELIN_SERVER_RPC_PORT); + if (StringUtils.isBlank(zeppelinServerRpcPort)) { return OptionalInt.empty(); } - return OptionalInt.of(Integer.parseInt(eventServerPort)); + return OptionalInt.of(Integer.parseInt(zeppelinServerRpcPort)); } public String getServerContextPath() { @@ -956,7 +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_EVENT_SERVER_PORT("zeppelin.event.server.port", 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"), diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java index 71b5430a4b8..ec83737ae4e 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java @@ -50,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; @@ -104,7 +103,7 @@ public RemoteInterpreterEventServer(ZeppelinConfiguration zConf, } public void start() throws IOException { - final OptionalInt portOpt = zConf.getEventServerPort(); + final OptionalInt portOpt = zConf.getZeppelinServerRpcPort(); Thread startingThread = new Thread() { @Override public void run() { From d4f81e7fe7bac4484ef3052aa03550b3dc1cbf41 Mon Sep 17 00:00:00 2001 From: Chan Ho Lee Date: Mon, 11 Nov 2024 20:03:34 +0900 Subject: [PATCH 3/5] Remove RemoteInterpreterEventServer.portRange --- .../zeppelin/interpreter/RemoteInterpreterEventServer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java index ec83737ae4e..bab3ee7b2ad 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java @@ -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; @@ -96,18 +95,18 @@ 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(); } public void start() throws IOException { - final OptionalInt portOpt = zConf.getZeppelinServerRpcPort(); Thread startingThread = new Thread() { @Override public void run() { - try (TServerSocket tSocket = new TServerSocket(portOpt.orElse(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); From db06e3d9c92db2fcf82522be4ad30f57fb0e15ec Mon Sep 17 00:00:00 2001 From: Chan Ho Lee Date: Mon, 11 Nov 2024 20:16:04 +0900 Subject: [PATCH 4/5] Add documentation for ZEPPELIN_SERVER_RPC_PORTRANGE configuration --- docs/setup/operation/configuration.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/setup/operation/configuration.md b/docs/setup/operation/configuration.md index af621e105c6..bba14790f1e 100644 --- a/docs/setup/operation/configuration.md +++ b/docs/setup/operation/configuration.md @@ -61,11 +61,21 @@ Sources descending by priority: 8443 Zeppelin Server ssl port (used when ssl environment/property is set to true) + +
ZEPPELIN_SERVER_RPC_PORTRANGE
+
zeppelin.server.rpc.portRange
+ + Port range for the Zeppelin Interpreter Event Server. If not set start from 1024 to 65535 will be used automatically.
+ + Note: If ZEPPELIN_SERVER_RPC_PORT is set, this property will be ignored. + + + +
ZEPPELIN_SERVER_RPC_PORT
zeppelin.server.rpc.port
Port for the Zeppelin Interpreter Event Server. If not set, an available port will be used automatically. -
ZEPPELIN_JMX_ENABLE
From 344242dc641f43311486aa781f21ac7eb9ae7e5c Mon Sep 17 00:00:00 2001 From: Chan Ho Lee Date: Mon, 11 Nov 2024 20:33:36 +0900 Subject: [PATCH 5/5] Add documentation for ZEPPELIN_INTERPRETER_RPC_PORTRANGE configuration --- docs/setup/operation/configuration.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/setup/operation/configuration.md b/docs/setup/operation/configuration.md index bba14790f1e..9588cd25a5b 100644 --- a/docs/setup/operation/configuration.md +++ b/docs/setup/operation/configuration.md @@ -64,11 +64,22 @@ Sources descending by priority:
ZEPPELIN_SERVER_RPC_PORTRANGE
zeppelin.server.rpc.portRange
- - Port range for the Zeppelin Interpreter Event Server. If not set start from 1024 to 65535 will be used automatically.
- - Note: If ZEPPELIN_SERVER_RPC_PORT is set, this property will be ignored. - + : + + Specifies the port range for the Zeppelin Interpreter Event Server. +
Format: <startPort>:<endPort> +
If the <startPort> is omitted, the range will begin at 1024. If the <endPort> is omitted, the range will extend up to 65535. +
Note: If zeppelin.server.rpc.port is set, this property will be ignored. + + + +
ZEPPELIN_INTERPRETER_RPC_PORTRANGE
+
zeppelin.interpreter.rpc.portRange
+ : + + Specifies the port range for the Zeppelin Interpreter. +
Format: <startPort>:<endPort> +
If the <startPort> is omitted, the range will begin at 1024. If the <endPort> is omitted, the range will extend up to 65535.