2016-04-03 10:09:24 -04:00
|
|
|
==== 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-reload
|
|
|
|
sudo /bin/systemctl enable elasticsearch.service
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
Elasticsearch can be started and stopped as follows:
|
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------
|
|
|
|
sudo systemctl start elasticsearch.service
|
|
|
|
sudo systemctl stop elasticsearch.service
|
|
|
|
--------------------------------------------
|
|
|
|
|
|
|
|
These commands provide no feedback as to whether Elasticsearch was started
|
2016-09-12 10:56:13 -04:00
|
|
|
successfully or not. Instead, this information will be written in the log
|
|
|
|
files located in `/var/log/elasticsearch/`.
|
|
|
|
|
|
|
|
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 using
|
|
|
|
the `journalctl` commands:
|
|
|
|
|
|
|
|
To tail the journal:
|
2016-04-03 10:09:24 -04:00
|
|
|
|
|
|
|
[source,sh]
|
|
|
|
--------------------------------------------
|
|
|
|
sudo journalctl -f
|
|
|
|
--------------------------------------------
|
|
|
|
|
2016-09-12 10:56:13 -04:00
|
|
|
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"
|
|
|
|
--------------------------------------------
|
2016-04-03 10:09:24 -04:00
|
|
|
|
2016-09-12 10:56:13 -04:00
|
|
|
Check `man journalctl` or https://www.freedesktop.org/software/systemd/man/journalctl.html for
|
|
|
|
more command line options.
|