| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 | ==== Running Elasticsearch with `systemd`To configure Elasticsearch to start automatically when the system boots up,run the following commands:[source,sh]--------------------------------------------------sudo /bin/systemctl daemon-reloadsudo /bin/systemctl enable elasticsearch.service--------------------------------------------------Elasticsearch can be started and stopped as follows:[source,sh]--------------------------------------------sudo systemctl start elasticsearch.servicesudo systemctl stop elasticsearch.service--------------------------------------------These commands provide no feedback as to whether Elasticsearch was startedsuccessfully or not. Instead, this information will be written in the logfiles located in `/var/log/elasticsearch/`.If you have password-protected your {es} keystore, you will need to provide`systemd` with the keystore password using a local file and systemd environmentvariables. This local file should be protected while it exists and may besafely deleted once Elasticsearch is up and running.[source,sh]-----------------------------------------------------------------------------------echo "keystore_password" > /path/to/my_pwd_file.tmpchmod 600 /path/to/my_pwd_file.tmpsudo systemctl set-environment ES_KEYSTORE_PASSPHRASE_FILE=/path/to/my_pwd_file.tmpsudo systemctl start elasticsearch.service-----------------------------------------------------------------------------------By default the Elasticsearch service doesn't log information in the `systemd`journal. To enable `journalctl` logging, the `--quiet` option must be removed from the `ExecStart` command line in the `elasticsearch.service` file.When `systemd` logging is enabled, the logging information are available usingthe `journalctl` commands:To tail the journal:[source,sh]--------------------------------------------sudo journalctl -f--------------------------------------------To list journal entries for the elasticsearch service:[source,sh]--------------------------------------------sudo journalctl --unit elasticsearch--------------------------------------------To list journal entries for the elasticsearch service starting from a given time:[source,sh]--------------------------------------------sudo journalctl --unit elasticsearch --since  "2016-10-30 18:17:16"--------------------------------------------Check `man journalctl` or https://www.freedesktop.org/software/systemd/man/journalctl.html formore command line options.
 |