]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15070 Fix error when sometimes setting sonar.search.host causes SQ to fail...
authorJacek <jacek.poreda@sonarsource.com>
Wed, 17 Nov 2021 16:09:46 +0000 (17:09 +0100)
committersonartech <sonartech@sonarsource.com>
Thu, 18 Nov 2021 20:03:33 +0000 (20:03 +0000)
server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java

index 562fba9d87bc02b623747e4a9b8d91451ffb3f25..3dd12e655f5793f067612711ca2d849a3fc8fe43 100644 (file)
@@ -151,14 +151,16 @@ public class EsSettings {
       int searchPort = Integer.parseInt(props.nonNullValue(SEARCH_PORT.getKey()));
       builder.put(ES_HTTP_HOST_KEY, searchHost.getHostAddress());
       builder.put(ES_HTTP_PORT_KEY, valueOf(searchPort));
-      builder.put(ES_NETWORK_HOST_KEY, searchHost.getHostAddress());
       builder.put("discovery.seed_hosts", searchHost.getHostAddress());
       builder.put("cluster.initial_master_nodes", searchHost.getHostAddress());
 
       int transportPort = Integer.parseInt(props.nonNullValue(ES_PORT.getKey()));
 
       // we have no use of transport port in non-DCE editions
-      builder.put(ES_TRANSPORT_HOST_KEY, this.loopbackAddress.getHostAddress());
+      // but specified host must be the one listed in: discovery.seed_hosts
+      // otherwise elasticsearch cannot elect master node
+      // by default it will be localhost, see: org.sonar.process.ProcessProperties.completeDefaults
+      builder.put(ES_TRANSPORT_HOST_KEY, searchHost.getHostAddress());
       builder.put(ES_TRANSPORT_PORT_KEY, valueOf(transportPort));
     }