| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 | [[setting-system-settings]]=== Configuring system settingsWhere to configure systems settings depends on which package you have used toinstall Elasticsearch, and which operating system you are using.When using the `.zip` or `.tar.gz` packages, system settings can be configured:* temporarily with <<ulimit,`ulimit`>>, or* permanently in <<limits.conf,`/etc/security/limits.conf`>>.When using the RPM or Debian packages, most system settings are set in the<<sysconfig,system configuration file>>. However, systems which use systemdrequire that system limits are specified in a<<systemd,systemd configuration file>>.[[ulimit]]==== `ulimit`On Linux systems, `ulimit` can be used to change resource limits on atemporary basis. Limits usually need to be set as `root` before switching tothe user that will run Elasticsearch.  For example, to set the number ofopen file handles (`ulimit -n`) to 65,536, you can do the following:[source,sh]--------------------------------sudo su  <1>ulimit -n 65536 <2>su elasticsearch <3>--------------------------------<1> Become `root`.<2> Change the max number of open files.<3> Become the `elasticsearch` user in order to start Elasticsearch.The new limit is only applied during the current session.You can consult all currently applied limits with `ulimit -a`.[[limits.conf]]==== `/etc/security/limits.conf`On Linux systems, persistent limits can be set for a particular user byediting the `/etc/security/limits.conf` file. To set the maximum number ofopen files for the `elasticsearch` user to 65,536, add the following line tothe `limits.conf` file:[source,sh]--------------------------------elasticsearch  -  nofile  65536--------------------------------This change will only take effect the next time the `elasticsearch` user opensa new session.[NOTE].Ubuntu and `limits.conf`===============================Ubuntu ignores the `limits.conf` file for processes started by `init.d`.  Toenable the `limits.conf` file, edit `/etc/pam.d/su` and uncomment thefollowing line:[source,sh]--------------------------------# session    required   pam_limits.so--------------------------------===============================[[sysconfig]]==== Sysconfig fileWhen using the RPM or Debian packages, system settings and environmentvariables can be specified in the system configuration file, which is locatedin:[horizontal]RPM::     `/etc/sysconfig/elasticsearch`Debian::  `/etc/default/elasticsearch`However, for systems which uses `systemd`, system limits need to be specifiedvia <<systemd,systemd>>.[[systemd]]==== Systemd configurationWhen using the RPM or Debian packages on systems that usehttps://en.wikipedia.org/wiki/Systemd[systemd], system limits must bespecified via systemd.The systemd service file (`/usr/lib/systemd/system/elasticsearch.service`)contains the limits that are applied by default.To override these, add a file called`/etc/systemd/system/elasticsearch.service.d/elasticsearch.conf`) and specifyany changes in that file, such as:[source,sh]---------------------------------LimitMEMLOCK=infinity---------------------------------[[es-java-opts]]==== Setting JVM system propertiesThe preferred method of setting Java Virtual Machine options (includingsystem properties and JVM flags) is via the jvm.options configurationfile. The default location of this file is config/jvm.options (wheninstalling from the tar or zip distributions) and/etc/elasticsearch/jvm.options (when installing from the Debian or RPMpackages). This file contains a line-delimited list of JVM arguments,which must begin with `-`. You can add custom JVM flags to this file andcheck this configuration into your version control system.An alternative mechanism for setting Java Virtual Machine options isvia 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>>.
 |