LoginSignup
2
0

More than 3 years have passed since last update.

HomebrewでElasticsearch 7.5.1を起動した時のエラー解消

Last updated at Posted at 2020-01-12

以下を参照してelasticsearchをインストールした時に少しハマったので自身へのメモ。
elasticsearch公式のインストールページ

elasticsearchを実行すると以下のエラーで終了してしまう。

$ elasticsearch -V
Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
output:
[0.002s][error][logging] Error opening log file 'logs/gc.log': No such file or directory
[0.002s][error][logging] Initialization of output 'file=logs/gc.log' using options 'filecount=32,filesize=64m' failed.
error:
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Invalid -Xlog option '-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m', see error log for details.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
    at org.elasticsearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:111)
    at org.elasticsearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:79)
    at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:57)
    at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:89)

対応方法としては、以下のファイルの該当パスを絶対パスに書き換えると解消する。

/usr/local/etc/elasticsearch/jvm.options

この行↓を

# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m

これに↓修正

# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=/usr/local/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m

2020/1/13追記

これでうまく動いていたと思ったけどやっぱり動いていない。

$ elasticsearch -d

でデーモン起動すると

1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured


上記のエラーでうまく動作していなかった。
どうも、discovery.seed_hosts: の設定が必須になったみたい。

shell-session
usr/local/etc/elasticsearch/elasticsearch.yml

に以下の設定を追加することで起動するようになりましたが、色々とちゃんと調べないといけないかなと思ってます。

network.bind_host: 0
discovery.seed_hosts: ["127.0.0.1", "[::1]"]

2020/1/13追記 その2

その後、やっぱり結局動いてなくて色々と調べていましたが、
なんのことはない、以下の設定ファイル関連を一旦削除して再度インストールしたら
問題なく動作することがわかりました。
おそらく以前のバージョンの設定ファイルが存在したままだったのかな。お恥ずかしい...

/usr/local/etc/elasticsearch
/usr/local/etc/kibana
/usr/local/etc/logstash
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0