diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2021-11-17 17:09:46 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-11-18 20:03:33 +0000 |
commit | 2cc3673f24b3d745f5c7fefe9051ebd557f211bd (patch) | |
tree | 21e84acb7b7a5df72290be29a3b441527c6f4de5 /server/sonar-main/src/main/java/org/sonar | |
parent | 8ec44b87f3f3bd2450009775abd65d2a75c4e791 (diff) | |
download | sonarqube-2cc3673f24b3d745f5c7fefe9051ebd557f211bd.tar.gz sonarqube-2cc3673f24b3d745f5c7fefe9051ebd557f211bd.zip |
SONAR-15070 Fix error when sometimes setting sonar.search.host causes SQ to fail at start
Diffstat (limited to 'server/sonar-main/src/main/java/org/sonar')
-rw-r--r-- | server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java | 6 |
1 files changed, 4 insertions, 2 deletions
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)); } |