1
0

as-a-service.asciidoc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. [[setup-service]]
  2. == Running As a Service on Linux
  3. In order to run elasticsearch as a service on your operating system, the provided packages try to make it as easy as possible for you to start and stop elasticsearch during reboot and upgrades.
  4. === Linux
  5. Currently our build automatically creates a debian package and an RPM package, which is available on the download page. The package itself does not have any dependencies, but you have to make sure that you installed a JDK.
  6. Each package features a configuration file, which allows you to set the following parameters
  7. [horizontal]
  8. `ES_USER`:: The user to run as, defaults to `elasticsearch`
  9. `ES_GROUP`:: The group to run as, defaults to `elasticsearch`
  10. `ES_HEAP_SIZE`:: The heap size to start with
  11. `ES_HEAP_NEWSIZE`:: The size of the new generation heap
  12. `ES_DIRECT_SIZE`:: The maximum size of the direct memory
  13. `MAX_OPEN_FILES`:: Maximum number of open files, defaults to `65535`
  14. `MAX_LOCKED_MEMORY`:: Maximum locked memory size. Set to "unlimited" if you use the bootstrap.mlockall option in elasticsearch.yml. You must also set ES_HEAP_SIZE.
  15. `LOG_DIR`:: Log directory, defaults to `/var/log/elasticsearch`
  16. `DATA_DIR`:: Data directory, defaults to `/var/lib/elasticsearch`
  17. `WORK_DIR`:: Work directory, defaults to `/tmp/elasticsearch`
  18. `CONF_DIR`:: Configuration file directory (which needs to include `elasticsearch.yml` and `logging.yml` files), defaults to `/etc/elasticsearch`
  19. `CONF_FILE`:: Path to configuration file, defaults to `/etc/elasticsearch/elasticsearch.yml`
  20. `ES_JAVA_OPTS`:: Any additional java options you may want to apply
  21. `RESTART_ON_UPGRADE`:: Configure restart on package upgrade, defaults to `false`. This means you will have to restart your elasticsearch instance after installing a package manually. The reason for this is to ensure, that upgrades in a cluster do not result in a continouos shard reallocation resulting in high network traffic and reducing the response times of your cluster.
  22. ==== Debian/Ubuntu
  23. The debian package ships with everything you need as it uses standard debian tools like update `update-rc.d` to define the runlevels it runs on. The init script is placed at `/etc/init.d/elasticsearch` is you would expect it. The configuration file is placed at `/etc/default/elasticsearch`.
  24. ==== RedHat/Centos/Fedora
  25. RedHat based distributions are using `chkconfig` to enable and disable services. The init script is at `/etc/init.d/elasticsearch`, where as the configuration file is placed at `/etc/sysconfig/elasticsearch`.
  26. ==== SuSe
  27. SuSe does not use the `chkconfig` tool to register services, but rather `systemd` and its command `/bin/systemctl` to start and stop services. The configuration file is also placed at `/etc/sysconfig/elasticsearch`.