You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2022/10/18 20:37:14 UTC

[solr] branch main updated: SOLR-16150 Provide correct bound zookeeper interface (#802)

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new c80cf5b03ac SOLR-16150 Provide correct bound zookeeper interface (#802)
c80cf5b03ac is described below

commit c80cf5b03ac1b1307df65ebe37f6ffdb26611013
Author: Mike Drob <md...@apache.org>
AuthorDate: Tue Oct 18 15:37:07 2022 -0500

    SOLR-16150 Provide correct bound zookeeper interface (#802)
    
    Instead of always giving localhost, we can return the interface that ZK actually listens on.
    
    Co-authored-by: Kevin Risden <kr...@apache.org>
---
 solr/CHANGES.txt                                           | 3 ++-
 solr/core/src/java/org/apache/solr/cloud/SolrZkServer.java | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c7ef3c7ea8c..d4bd4c479f3 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -82,7 +82,8 @@ Build
 
 Other Changes
 ---------------------
-(No changes)
+* SOLR-16150: Embedded ZK Server used for zkRun should advertise itself on specific bound interfaces instead of
+  generically on localhost. (Mike Drob)
 
 ==================  9.1.0 ==================
 
diff --git a/solr/core/src/java/org/apache/solr/cloud/SolrZkServer.java b/solr/core/src/java/org/apache/solr/cloud/SolrZkServer.java
index 95021c74abe..f340f4d6c4d 100644
--- a/solr/core/src/java/org/apache/solr/cloud/SolrZkServer.java
+++ b/solr/core/src/java/org/apache/solr/cloud/SolrZkServer.java
@@ -70,7 +70,9 @@ public class SolrZkServer {
 
     // if the string wasn't passed as zkHost, then use the standalone server we started
     if (zkRun == null) return null;
-    return "localhost:" + zkProps.getClientPortAddress().getPort();
+
+    InetSocketAddress addr = zkProps.getClientPortAddress();
+    return addr.getHostString() + ":" + addr.getPort();
   }
 
   public void parseConfig() {