diff options
author | Michal Duda <michal.duda@sonarsource.com> | 2020-10-30 13:31:18 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-11-05 20:06:21 +0000 |
commit | 55ba8c6100ba8afc608958fce60dcc38a5a709a2 (patch) | |
tree | e8f43b114abb2acddbfd70f487007d58c253757d | |
parent | 874973829ca3a7ba8e39709d478695216357cf97 (diff) | |
download | sonarqube-55ba8c6100ba8afc608958fce60dcc38a5a709a2.tar.gz sonarqube-55ba8c6100ba8afc608958fce60dcc38a5a709a2.zip |
SONAR-12686 Fix Elasticsearch properties for a single node
- https://www.elastic.co/guide/en/elasticsearch/reference/7.x/breaking-changes-7.0.html#_discovery_configuration_is_required_in_production
-rw-r--r-- | server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java | 4 | ||||
-rw-r--r-- | server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java | 5 |
2 files changed, 6 insertions, 3 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 51323964cae..dc3b606d1c4 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 @@ -108,7 +108,9 @@ 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, valueOf(searchHost.getHostAddress())); + 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())); diff --git a/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java index f3722d1332a..af87c10b721 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java @@ -150,14 +150,15 @@ public class EsSettingsTest { .containsEntry("http.host", "127.0.0.1") // no cluster, but cluster and node names are set though .containsEntry("cluster.name", "sonarqube") - .containsEntry("node.name", "sonarqube"); + .containsEntry("node.name", "sonarqube") + .containsEntry("discovery.seed_hosts", "127.0.0.1") + .containsEntry("cluster.initial_master_nodes", "127.0.0.1"); assertThat(generated.get("path.data")).isNotNull(); assertThat(generated.get("path.logs")).isNotNull(); assertThat(generated.get("path.home")).isNull(); assertThat(generated.get("path.conf")).isNull(); - assertThat(generated.get("discovery.seed_hosts")).isNull(); assertThat(generated) .containsEntry("discovery.initial_state_timeout", "30s") .containsEntry("action.auto_create_index", "false"); |