1
0

systemd.asciidoc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ==== Running Elasticsearch with `systemd`
  2. To configure Elasticsearch to start automatically when the system boots up,
  3. run the following commands:
  4. [source,sh]
  5. --------------------------------------------------
  6. sudo /bin/systemctl daemon-reload
  7. sudo /bin/systemctl enable elasticsearch.service
  8. --------------------------------------------------
  9. Elasticsearch can be started and stopped as follows:
  10. [source,sh]
  11. --------------------------------------------
  12. sudo systemctl start elasticsearch.service
  13. sudo systemctl stop elasticsearch.service
  14. --------------------------------------------
  15. These commands provide no feedback as to whether Elasticsearch was started
  16. successfully or not. Instead, this information will be written in the log
  17. files located in `/var/log/elasticsearch/`.
  18. By default the Elasticsearch service doesn't log information in the `systemd`
  19. journal. To enable `journalctl` logging, the `--quiet` option must be removed
  20. from the `ExecStart` command line in the `elasticsearch.service` file.
  21. When `systemd` logging is enabled, the logging information are available using
  22. the `journalctl` commands:
  23. To tail the journal:
  24. [source,sh]
  25. --------------------------------------------
  26. sudo journalctl -f
  27. --------------------------------------------
  28. To list journal entries for the elasticsearch service:
  29. [source,sh]
  30. --------------------------------------------
  31. sudo journalctl --unit elasticsearch
  32. --------------------------------------------
  33. To list journal entries for the elasticsearch service starting from a given time:
  34. [source,sh]
  35. --------------------------------------------
  36. sudo journalctl --unit elasticsearch --since "2016-10-30 18:17:16"
  37. --------------------------------------------
  38. Check `man journalctl` or https://www.freedesktop.org/software/systemd/man/journalctl.html for
  39. more command line options.