From: Jacek Date: Wed, 17 Nov 2021 16:09:46 +0000 (+0100) Subject: SONAR-15070 Fix error when sometimes setting sonar.search.host causes SQ to fail... X-Git-Tag: 9.2.0.49834~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2cc3673f24b3d745f5c7fefe9051ebd557f211bd;p=sonarqube.git SONAR-15070 Fix error when sometimes setting sonar.search.host causes SQ to fail at start --- diff --git a/server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java b/server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java index 562fba9d87b..3dd12e655f5 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java +++ b/server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java @@ -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)); }