janhoy commented on code in PR #5347:
URL: https://github.com/apache/solr/pull/5347#discussion_r4717407047


##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -668,9 +669,11 @@ void runSecureExample(CloudExampleParams params, boolean 
userManaged) throws Exc
             + serverDir.getParent().toAbsolutePath().normalize());
     Path tls = home.resolve("tls");
     Path include = tls.resolve("solr.in.sh");
-    String zkHost = "localhost:" + (port + 1000);
+    int zkPort = SolrZkServer.resolveClientPort(port);
+    String zkHost = "localhost:" + zkPort;

Review Comment:
   🤖 No change: that behaviour predates this PR, and a hand-set `clientPort` in 
a custom server dir is out of scope for the examples.



##########
solr/bin/solr.cmd:
##########
@@ -973,8 +974,8 @@ IF "%SOLR_MODE%"=="solrcloud" (
   IF NOT "%ZK_HOST%"=="" (
     set "CLOUD_MODE_OPTS=!CLOUD_MODE_OPTS! -DzkHost=%ZK_HOST%"
   ) ELSE (
-    IF %SOLR_PORT_LISTEN% GTR 64535 (
-      set "SCRIPT_ERROR=ZK_HOST is not set and Solr port is 
%SOLR_PORT_LISTEN%, which would result in an invalid embedded Zookeeper port!"
+    IF %SOLR_PORT_LISTEN% GTR 64000 (

Review Comment:
   🤖 Agreed, done in 4407361fe94: both scripts are back to the old 64535 
ceiling, and skip it when `SOLR_ZOOKEEPER_EMBEDDED_PORT` sets the port 
explicitly.



##########
solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc:
##########
@@ -63,6 +63,7 @@ NOTE: If you have defined `ZK_HOST` in 
`solr.in.sh`/`solr.in.cmd` (see xref:zook
 
 When starting Solr in SolrCloud mode, if you do not define `ZK_HOST` in 
`solr.in.sh`/`solr.in.cmd` nor specify the `-z` option, then Solr will launch 
an embedded ZooKeeper server listening on the Solr port + 1000.
 For example, if Solr is running on port 8983, then the embedded ZooKeeper will 
listen on port 9983.
+To use a different port, set `SOLR_ZOOKEEPER_EMBEDDED_PORT` in 
`solr.in.sh`/`solr.in.cmd` (or the `-Dsolr.zookeeper.embedded.port` system 
property).

Review Comment:
   🤖 The `-e` examples own their port layout and don't take this setting, so 
the guide now says they always use the Solr port + 1000 (4407361fe94).



##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -668,9 +670,11 @@ void runSecureExample(CloudExampleParams params, boolean 
userManaged) throws Exc
             + serverDir.getParent().toAbsolutePath().normalize());
     Path tls = home.resolve("tls");
     Path include = tls.resolve("solr.in.sh");
-    String zkHost = "localhost:" + (port + 1000);
+    int zkPort = SolrZkServer.resolveClientPort(port);

Review Comment:
   🤖 No change: the failure cleanup comes from #5306 and this PR does not touch 
it, so it is out of scope here.



##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -1581,6 +1585,12 @@ Map<String, Object> startSolr(
     if (zkHost != null) {
       command.add("-z");
       command.add(zkHost);
+    } else if (cloudMode) {
+      // this node starts the embedded ZooKeeper, so pass on an explicitly 
configured port
+      Integer embeddedZkPort = SolrZkServer.getConfiguredClientPort();
+      if (embeddedZkPort != null) {
+        command.add("-D" + SolrZkServer.EMBEDDED_ZK_PORT_PROPERTY + "=" + 
embeddedZkPort);

Review Comment:
   🤖 Not worth it for an example tool, which keeps its own layout. In the 
future the examples could use the configurable port to pin every port they need.



##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -668,9 +670,11 @@ void runSecureExample(CloudExampleParams params, boolean 
userManaged) throws Exc
             + serverDir.getParent().toAbsolutePath().normalize());
     Path tls = home.resolve("tls");
     Path include = tls.resolve("solr.in.sh");
-    String zkHost = "localhost:" + (port + 1000);
+    int zkPort = SolrZkServer.resolveClientPort(port);
+    String zkHost = "localhost:" + zkPort;
     Map<String, String> environment = new 
HashMap<>(EnvironmentUtils.getProcEnvironment());
     environment.put("SOLR_INCLUDE", include.toString());
+    environment.put("SOLR_ZOOKEEPER_EMBEDDED_PORT", Integer.toString(zkPort));

Review Comment:
   🤖 No change: this is an example environment, where an occasional port 
conflict is acceptable, and the examples no longer take the setting.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to