5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

MacのOSをVentureにアップデートするとElasticSearchが動かなくなる問題の解決策

Last updated at Posted at 2023-02-16

いつものようにelasticsearchを起動しようとしたら、could not find java in bundled JDK at /opt/homebrew/Cellar/elasticsearch-full/7.17.4/libexec/jdk.app/Contents/Home/bin/javaとか
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release at java.base/java.lang.System.setSecurityManager(System.java:425) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:82)とか怒られてびっくりしちゃったあなたへ。

概要

MacのOSをVentureに上げると、以下のようにElasticSearchが動かなくなる問題があるようです。

結論からいうと、以下の2つのコメントを参考に解決できました。

いや、正直に告白すると、ESの再インストールと

Macの標準のJavaのアンインストールと、

Java11の再インストールと、

openjdk11のインストールとかもやりました。

疲れました。

解決手順

ほとんどIssueの翻訳です。

1, JAVAのPATHをコピー

/usr/libexec/java_home
# PATHをコピーしておく
>> /usr/local/Cellar/openjdk@11/11.0.18/libexec/openjdk.jdk/Contents/Home

2 ~/homebrew.mxcl.elasticsearch-full.plist を編集する

could not find java in bundled JDK at に続く、elasticsearch-full/バージョン情報 以下の homebrew.mxcl.elasticsearch-full.plist を編集する。

vim /opt/homebrew/Cellar/elasticsearch-full/7.17.4/homebrew.mxcl.elasticsearch-full.plist

ファイルに以下を追記。

<key>EnvironmentVariables</key>
    <dict>
      <key>ES_JAVA_HOME</key>
      <string>「コピーしたJAVAのPATH」</string>
    </dict>

3

vim /opt/homebrew/etc/elasticsearch/elasticsearch.yml

ファイルの一番下に以下を追記。

xpack.ml.enabled: false

4

export ES_JAVA_HOME=$(/usr/libexec/java_home)

5, source ~/.bash_profileとかsource ~/.zshrcとか

6, ESの再起動

# プロセスをkill
ps aux | grep 'elastic' | grep -v grep | awk '{ print "kill -9", $2 }' | sh
# ES起動
elasticsearch

動いたならおめでとう。
動かなかったら自分と同じように一旦ESの再インストールから始めてもいいかもしれませんね。
Fingers Crossed!!

OSのアップグレードのせいでESが動かなくなるなんて正直思いもしなかったので結構焦りました。
今回は「何もしてないのに壊れた」と言っても許されるはず。

それにしても今回は英語が読めて助かったなぁ〜〜〜!!!!
効率的に語彙が覚えられるDiQtってアプリ、やっぱりすごいなぁ〜〜〜〜!!!!(広告)

could not find java in bundled JDK at /usr/local/Cellar/elasticsearch-full/7.17.4/libexec/jdk.app/Contents/Home/bin/java の場合

なんかしばらくしたらまた動かなくなったのだが、その際は could not find java in bundled JDK at /usr/local/Cellar/elasticsearch-full/7.17.4/libexec/jdk.app/Contents/Home/bin/java ということだった。

/opt/homebrew/Cellar ではなく、 /usr/local/Cellar にhomebrewが入っている場合、以下をすると動いた。

/usr/libexec/java_home
# PATHをコピーしておく
>> /usr/local/Cellar/openjdk@11/11.0.18/libexec/openjdk.jdk/Contents/Home

could not find java in bundled JDK at に続く、elasticsearch-full/バージョン情報 以下の homebrew.mxcl.elasticsearch-full.plist を編集する。

vim /usr/local/Cellar/elasticsearch-full/7.17.4/homebrew.mxcl.elasticsearch-full.plist

ファイルに以下を追記。

<key>EnvironmentVariables</key>
    <dict>
      <key>ES_JAVA_HOME</key>
      <string>「コピーしたJAVAのPATH」</string>
    </dict>

最後におまじない。

 export ES_JAVA_HOME=$(/usr/libexec/java_home)
 source ~/.bash_profile

参考:

まぁ他にも色々したから自信はないけど備忘録。

5
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
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?