Skip to content

Commit

Permalink
Disable disk-based shard allocation thresholds for Elasticsearch in d…
Browse files Browse the repository at this point in the history
…ev services and tests

In a single-node setup they just don't make sense,
and lead to problems on large disks with little space left.
See https://www.elastic.co/guide/en/elasticsearch/reference/8.8/modules-cluster.html#disk-based-shard-allocation
  • Loading branch information
yrodiere committed Aug 2, 2023
1 parent 1073685 commit 6345274
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 5 deletions.
5 changes: 5 additions & 0 deletions docs/src/main/asciidoc/centralized-log-management.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ services:
environment:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
discovery.type: "single-node"
cluster.routing.allocation.disk.threshold_enabled: false
networks:
- graylog
Expand Down Expand Up @@ -197,6 +198,7 @@ services:
environment:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
discovery.type: "single-node"
cluster.routing.allocation.disk.threshold_enabled: false
networks:
- elk
Expand Down Expand Up @@ -286,6 +288,7 @@ services:
environment:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
discovery.type: "single-node"
cluster.routing.allocation.disk.threshold_enabled: false
networks:
- efk
Expand Down Expand Up @@ -372,6 +375,8 @@ services:
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
discovery.type: "single-node"
cluster.routing.allocation.disk.threshold_enabled: false
networks:
- efk
Expand Down
1 change: 1 addition & 0 deletions docs/src/main/asciidoc/elasticsearch.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ If you want to use Docker to run an Elasticsearch instance, you can use the foll
[source,bash,subs=attributes+]
----
docker run --name elasticsearch -e "discovery.type=single-node" -e "ES_JAVA_OPTS=-Xms512m -Xmx512m"\
-e "cluster.routing.allocation.disk.threshold_enabled=false"
--rm -p 9200:9200 {elasticsearch-image}
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ private DevServicesResultBuildItem.RunningDevService startElasticsearch(
container.addEnv("ES_JAVA_OPTS", config.javaOpts);
// Disable security as else we would need to configure it correctly to avoid tons of WARNING in the log
container.addEnv("xpack.security.enabled", "false");
// Disable disk-based shard allocation thresholds:
// in a single-node setup they just don't make sense,
// and lead to problems on large disks with little space left.
// See https://www.elastic.co/guide/en/elasticsearch/reference/8.8/modules-cluster.html#disk-based-shard-allocation
container.addEnv( "cluster.routing.allocation.disk.threshold_enabled", "false" );

container.start();
return new DevServicesResultBuildItem.RunningDevService(Feature.ELASTICSEARCH_REST_CLIENT_COMMON.getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@
<discovery.type>single-node</discovery.type>
<xpack.security.enabled>false</xpack.security.enabled>
<ES_JAVA_OPTS>-Xms512m -Xmx512m</ES_JAVA_OPTS>
<!-- Disable disk-based shard allocation thresholds:
in a single-node setup they just don't make sense,
and lead to problems on large disks with little space left.
See https://www.elastic.co/guide/en/elasticsearch/reference/8.8/modules-cluster.html#disk-based-shard-allocation
-->
<cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
</env>
<ports>
<port>9200:9200</port>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@
<discovery.type>single-node</discovery.type>
<xpack.security.enabled>false</xpack.security.enabled>
<ES_JAVA_OPTS>-Xms512m -Xmx512m</ES_JAVA_OPTS>
<!-- Disable disk-based shard allocation thresholds:
in a single-node setup they just don't make sense,
and lead to problems on large disks with little space left.
See https://www.elastic.co/guide/en/elasticsearch/reference/8.8/modules-cluster.html#disk-based-shard-allocation
-->
<cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
</env>
<ports>
<port>9200:9200</port>
Expand Down
6 changes: 6 additions & 0 deletions integration-tests/elasticsearch-java-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@
<discovery.type>single-node</discovery.type>
<xpack.security.enabled>false</xpack.security.enabled>
<ES_JAVA_OPTS>-Xms512m -Xmx512m</ES_JAVA_OPTS>
<!-- Disable disk-based shard allocation thresholds:
in a single-node setup they just don't make sense,
and lead to problems on large disks with little space left.
See https://www.elastic.co/guide/en/elasticsearch/reference/8.8/modules-cluster.html#disk-based-shard-allocation
-->
<cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
</env>
<ports>
<port>9200:9200</port>
Expand Down
6 changes: 6 additions & 0 deletions integration-tests/elasticsearch-rest-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@
<discovery.type>single-node</discovery.type>
<xpack.security.enabled>false</xpack.security.enabled>
<ES_JAVA_OPTS>-Xms512m -Xmx512m</ES_JAVA_OPTS>
<!-- Disable disk-based shard allocation thresholds:
in a single-node setup they just don't make sense,
and lead to problems on large disks with little space left.
See https://www.elastic.co/guide/en/elasticsearch/reference/8.8/modules-cluster.html#disk-based-shard-allocation
-->
<cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
</env>
<ports>
<port>9200:9200</port>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@
<discovery.type>single-node</discovery.type>
<xpack.security.enabled>false</xpack.security.enabled>
<ES_JAVA_OPTS>-Xms512m -Xmx512m</ES_JAVA_OPTS>
</env>
<!-- Disable disk-based shard allocation thresholds:
in a single-node setup they just don't make sense,
and lead to problems on large disks with little space left.
See https://www.elastic.co/guide/en/elasticsearch/reference/8.8/modules-cluster.html#disk-based-shard-allocation
-->
<cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled> </env>
<ports>
<port>9200:9200</port>
</ports>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@
<discovery.type>single-node</discovery.type>
<xpack.security.enabled>false</xpack.security.enabled>
<ES_JAVA_OPTS>-Xms512m -Xmx512m</ES_JAVA_OPTS>
<!-- Disable disk-based shard allocation thresholds:
in a single-node setup they just don't make sense,
and lead to problems on large disks with little space left.
See https://www.elastic.co/guide/en/elasticsearch/reference/8.8/modules-cluster.html#disk-based-shard-allocation
-->
<cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
</env>
<ports>
<port>9200:9200</port>
Expand Down
6 changes: 6 additions & 0 deletions integration-tests/hibernate-search-orm-elasticsearch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@
<discovery.type>single-node</discovery.type>
<xpack.security.enabled>false</xpack.security.enabled>
<ES_JAVA_OPTS>-Xms512m -Xmx512m</ES_JAVA_OPTS>
<!-- Disable disk-based shard allocation thresholds:
in a single-node setup they just don't make sense,
and lead to problems on large disks with little space left.
See https://www.elastic.co/guide/en/elasticsearch/reference/8.8/modules-cluster.html#disk-based-shard-allocation
-->
<cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
</env>
<ports>
<port>9200:9200</port>
Expand Down
9 changes: 5 additions & 4 deletions integration-tests/logging-gelf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,13 @@
<env>
<discovery.type>single-node</discovery.type>
<xpack.security.enabled>false</xpack.security.enabled>
<!--
Disable disk allocation decider as CI can be low on disk space and we
only create small indices.
<ES_JAVA_OPTS>-Xms512m -Xmx512m</ES_JAVA_OPTS>
<!-- Disable disk-based shard allocation thresholds:
in a single-node setup they just don't make sense,
and lead to problems on large disks with little space left.
See https://www.elastic.co/guide/en/elasticsearch/reference/8.8/modules-cluster.html#disk-based-shard-allocation
-->
<cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
<ES_JAVA_OPTS>-Xms512m -Xmx512m</ES_JAVA_OPTS>
</env>
<log>
<prefix>Elasticsearch:</prefix>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
discovery.type: "single-node"
xpack.security.enabled: "false"
cluster.routing.allocation.disk.threshold_enabled: false
networks:
- efk

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
discovery.type: "single-node"
xpack.security.enabled: "false"
cluster.routing.allocation.disk.threshold_enabled: false
networks:
- elk

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
discovery.type: "single-node"
xpack.security.enabled: "false"
cluster.routing.allocation.disk.threshold_enabled: false
networks:
- graylog

Expand Down

0 comments on commit 6345274

Please sign in to comment.