Elasticsearch

Ubuntu 16伺服器,systemctl restart elasticsearch什麼都不做,也沒有日誌

  • June 27, 2021

在 ubuntu 16 lts 伺服器系統上,新安裝的elasticsearch實例不會啟動systemctl restart elasticsearch(或啟動)。沒有創建日誌,/usr/share/elasticsearch/bin/elasticsearch 以使用者 elasticsearch WORKS 身份手動執行,因此權限或配置文件不是問題(我認為),當我執行命令時 /var/log/elasticsearch 中沒有日誌systemctl,所以我假設 systemctl 只是失敗默默地做任何事。

我不知道接下來要檢查什麼。是否有一些 /etc/init.d/##elasticsearch 腳本或壞的需要更換的東西?

systemctl 在 ubuntu 上做了什麼?它是否找到並執行 /etc/rc4.d/S01elasticsearch?還有什麼?

systemctl status elasticsearch 說:

● elasticsearch.service - LSB: Starts elasticsearch
  Loaded: loaded (/etc/init.d/elasticsearch; bad; vendor preset: enabled)
  Active: active (exited) since Mon 2016-11-07 16:29:25 EST; 2min 26s ago
    Docs: man:systemd-sysv-generator(8)
 Process: 1151 ExecStart=/etc/init.d/elasticsearch start (code=exited, status=0

Nov 07 16:29:25 webci systemd[1]: Starting LSB: Starts elasticsearch...
Nov 07 16:29:25 webci elasticsearch[1151]:  * Starting Elasticsearch Server
Nov 07 16:29:25 webci elasticsearch[1151]:    ...done.
Nov 07 16:29:25 webci systemd[1]: Started LSB: Starts elasticsearch.

我認為以上意味著它開始並靜默退出,沒有提供有用的日誌輸出。也沒有來自 journalctl 的額外日誌記錄。

如果我使用journalctl -xe我會得到一堆時鐘噪音,但沒有什麼有趣的:

Nov 07 16:33:44 webci elasticsearch[2273]:  * Starting Elasticsearch Server
Nov 07 16:33:44 webci elasticsearch[2273]:    ...done.
Nov 07 16:33:44 webci systemd[1]: Started LSB: Starts elasticsearch.
-- Subject: Unit elasticsearch.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit elasticsearch.service has finished starting up.
--
-- The start-up result is done.
Nov 07 16:33:44 webci sudo[2233]: pam_unix(sudo:session): session closed for use
Nov 07 16:34:08 webci smbd[2343]: pam_unix(samba:session): session closed for us
Nov 07 16:35:01 webci CRON[2356]: pam_unix(cron:session): session opened for use
Nov 07 16:35:01 webci CRON[2357]: (root) CMD (command -v debian-sa1 > /dev/null
Nov 07 16:35:01 webci CRON[2356]: pam_unix(cron:session): session closed for use
lin

看起來成功了,但是elasticsearch程序沒有執行,已經退出了。

您可以使用

systemctl status <service>

獲取有關服務狀態的基本資訊和 d

journalctl -xe

將在分頁程序中顯示 systemd 日誌的內容並跳轉到日誌的末尾。您可能需要向上滾動以獲取所需的資訊。

在 Ubuntu 16.04 上執行 elasticsearch 的解決方案是編輯/etc/default/elasticsearch,取消註釋該行,START_DAEMON=true然後執行systemctl restart elasticsearch

引用自:https://serverfault.com/questions/813676