configuration.asciidoc 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. [[settings]]
  2. == Configuring Elasticsearch
  3. Elasticsearch ships with good defaults and requires very little configuration.
  4. Most settings can be changed on a running cluster using the
  5. <<cluster-update-settings>> API.
  6. The configuration files should contain settings which are node-specific (such
  7. as `node.name` and paths), or settings which a node requires in order to be
  8. able to join a cluster, such as `cluster.name` and `network.host`.
  9. [[config-files-location]]
  10. [float]
  11. === Config files location
  12. Elasticsearch has three configuration files:
  13. * `elasticsearch.yml` for configuring Elasticsearch
  14. * `jvm.options` for configuring Elasticsearch JVM settings
  15. * `log4j2.properties` for configuring Elasticsearch logging
  16. These files are located in the config directory, whose default location depends
  17. on whether or not the installation is from an archive distribution (`tar.gz` or
  18. `zip`) or a package distribution (Debian or RPM packages).
  19. For the archive distributions, the config directory location defaults to
  20. `$ES_HOME/config`. The location of the config directory can be changed via the
  21. `ES_PATH_CONF` environment variable as follows:
  22. [source,sh]
  23. -------------------------------
  24. ES_PATH_CONF=/path/to/my/config ./bin/elasticsearch
  25. -------------------------------
  26. Alternatively, you can `export` the `ES_PATH_CONF` environment variable via the
  27. command line or via your shell profile.
  28. For the package distributions, the config directory location defaults to
  29. `/etc/elasticsearch`. The location of the config directory can also be changed
  30. via the `ES_PATH_CONF` environment variable, but note that setting this in your
  31. shell is not sufficient. Instead, this variable is sourced from
  32. `/etc/default/elasticsearch` (for the Debian package) and
  33. `/etc/sysconfig/elasticsearch` (for the RPM package). You will need to edit the
  34. `ES_PATH_CONF=/etc/elasticsearch` entry in one of these files accordingly to
  35. change the config directory location.
  36. [float]
  37. === Config file format
  38. The configuration format is http://www.yaml.org/[YAML]. Here is an
  39. example of changing the path of the data and logs directories:
  40. [source,yaml]
  41. --------------------------------------------------
  42. path:
  43. data: /var/lib/elasticsearch
  44. logs: /var/log/elasticsearch
  45. --------------------------------------------------
  46. Settings can also be flattened as follows:
  47. [source,yaml]
  48. --------------------------------------------------
  49. path.data: /var/lib/elasticsearch
  50. path.logs: /var/log/elasticsearch
  51. --------------------------------------------------
  52. [float]
  53. === Environment variable substitution
  54. Environment variables referenced with the `${...}` notation within the
  55. configuration file will be replaced with the value of the environment
  56. variable, for instance:
  57. [source,yaml]
  58. --------------------------------------------------
  59. node.name: ${HOSTNAME}
  60. network.host: ${ES_NETWORK_HOST}
  61. --------------------------------------------------