mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-16 09:54:55 +00:00
This commit reorganizes some of the content in the configuring Elasticsearch section of the docs. The changes are: - move JVM options out of system configuration into configuring Elasticsearch - move JVM options to its own page of the docs - move configuring the heap to important Elasticsearch settings - move configuring the heap to its own page of the docs - move all important settings to individual pages in the docs - remove bootstrap.memory_lock from important settings, this is covered in the swap section of system configuration Relates #27755
83 lines
2.9 KiB
Plaintext
83 lines
2.9 KiB
Plaintext
[[jvm-options]]
|
|
=== Setting JVM options
|
|
|
|
The preferred method of setting JVM options (including system properties and JVM
|
|
flags) is via the `jvm.options` configuration file. The default location of this
|
|
file is `config/jvm.options` (when installing from the tar or zip distributions)
|
|
and `/etc/elasticsearch/jvm.options` (when installing from the Debian or RPM
|
|
packages).
|
|
|
|
This file contains a line-delimited list of JVM arguments following
|
|
a special syntax:
|
|
|
|
* lines consisting of whitespace only are ignored
|
|
* lines beginning with `#` are treated as comments and are ignored
|
|
+
|
|
[source,text]
|
|
-------------------------------------
|
|
# this is a comment
|
|
-------------------------------------
|
|
|
|
* lines beginning with a `-` are treated as a JVM option that applies
|
|
independent of the version of the JVM
|
|
+
|
|
[source,text]
|
|
-------------------------------------
|
|
-Xmx2g
|
|
-------------------------------------
|
|
|
|
* lines beginning with a number followed by a `:` followed by a `-` are treated
|
|
as a JVM option that applies only if the version of the JVM matches the number
|
|
+
|
|
[source,text]
|
|
-------------------------------------
|
|
8:-Xmx2g
|
|
-------------------------------------
|
|
|
|
* lines beginning with a number followed by a `-` followed by a `:` are treated
|
|
as a JVM option that applies only if the version of the JVM is greater than or
|
|
equal to the number
|
|
+
|
|
[source,text]
|
|
-------------------------------------
|
|
8-:-Xmx2g
|
|
-------------------------------------
|
|
|
|
* lines beginning with a number followed by a `-` followed by a number followed
|
|
by a `:` are treated as a JVM option that applies only if the version of the
|
|
JVM falls in the range of the two numbers
|
|
+
|
|
[source,text]
|
|
-------------------------------------
|
|
8-9:-Xmx2g
|
|
-------------------------------------
|
|
|
|
* all other lines are rejected
|
|
|
|
You can add custom JVM flags to this file and check this configuration into your
|
|
version control system.
|
|
|
|
An alternative mechanism for setting Java Virtual Machine options is via the
|
|
`ES_JAVA_OPTS` environment variable. For instance:
|
|
|
|
[source,sh]
|
|
---------------------------------
|
|
export ES_JAVA_OPTS="$ES_JAVA_OPTS -Djava.io.tmpdir=/path/to/temp/dir"
|
|
./bin/elasticsearch
|
|
---------------------------------
|
|
|
|
When using the RPM or Debian packages, `ES_JAVA_OPTS` can be specified in the
|
|
<<sysconfig,system configuration file>>.
|
|
|
|
The JVM has a built-in mechanism for observing the `JAVA_TOOL_OPTIONS`
|
|
environment variable. We intentionally ignore this environment variable in our
|
|
packaging scripts. The primary reason for this is that on some OS (e.g., Ubuntu)
|
|
there are agents installed by default via this environment variable that we do
|
|
not want interfering with Elasticsearch.
|
|
|
|
Additionally, some other Java programs support the `JAVA_OPTS` environment
|
|
variable. This is *not* a mechanism built into the JVM but instead a convention
|
|
in the ecosystem. However, we do not support this environment variable, instead
|
|
supporting setting JVM options via the `jvm.options` file or the environment
|
|
variable `ES_JAVA_OPTS` as above.
|