Elasticsearchが「Failed to start Elasticsearch」で起動しなかった場合に対処した内容

Elasticsearchが「Failed to start Elasticsearch」で起動しなかった場合に対処した内容

Elasticsearchが「Failed to start Elasticsearch」で起動しなかった場合に対処した内容を記述してます。他にも起動しない原因はありそうですが、自分が起動しなかった原因は「systemd-entrypoint」で使用している「$ES_KEYSTORE_PASSPHRASE_FILE」が不適切だったためとなります。

環境

  • OS CentOS Stream release 9
  • Elasticsearch 8.4.3

statusの結果

「systemctl status elasticsearch.service」を実行した結果は以下となります。

$ systemctl status elasticsearch.service

× elasticsearch.service - Elasticsearch
     Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Tue 2022-10-25 19:38:04 JST; 8s ago
   Duration: 17h 46min 34.973s
       Docs: https://www.elastic.co
    Process: 1028561 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
   Main PID: 1028561 (code=exited, status=1/FAILURE)
        CPU: 6ms

10月 25 19:38:04 localhost.localdomain systemd[1]: Starting Elasticsearch...
10月 25 19:38:04 localhost.localdomain systemd-entrypoint[1028561]: /usr/share/elasticsearch/bin/systemd-entrypoint: 行 7: /home/testuser/my_pwd_file.t>10月 25 19:38:04 localhost.localdomain systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
10月 25 19:38:04 localhost.localdomain systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
10月 25 19:38:04 localhost.localdomain systemd[1]: Failed to start Elasticsearch.

原因

「/usr/share/elasticsearch/bin/systemd-entrypoint」で使用している値がおかしかったようです。
変数「$ES_KEYSTORE_PASSPHRASE_FILE」に問題があったようです。

対処法

「ES_KEYSTORE_PASSPHRASE_FILE」をとりあえずリセットすることで改善しました。

$ sudo systemctl set-environment ES_KEYSTORE_PASSPHRASE_FILE=