ビットの海

ゆるふわソフトウェアエンジニアしゃぜのブログ

オフィシャル版Elastic Homebrew Tapがリリースされてたので使ってみる

www.elastic.co

^ 去年出てたらしい(6月だから結構前だ)

そのままだとHEADしか入らないので指定Versionを入れたいときは別途小細工が必要

(とはいえ、このtap自体は7系以降じゃないとだめそうだ)

Elasticsearch & Kibana Usage

事前準備(tap)

brew tap elastic/tap

elasticsearch

install

デフォルト(Full)版のinstall

brew install elasticsearch-full

start & stop

# plist登録して起動
brew services start elastic/tap/elasticsearch-full

# 停止
brew services stop elastic/tap/elasticsearch-full

動作確認

curl http://localhost:9200

Config /usr/local/opt/elasticsearch-full/libexec/config (シンボリックリンクになっていて、実体は /usr/local/etc/elasticsearch/sudachi こっちになっている。ESの設定で指定するのは実体のほうがよい)

Log /usr/local/var/log/elasticsearch.log

kibana

install

デフォルト(Full)版のinstall

brew install elastic/tap/kibana-full

start & stop

# plist登録して起動
brew services start elastic/tap/kibana-full

# 停止
brew services stop elastic/tap/kibana-full

動作確認

open http://localhost:5601

オマケ、旧VersionをInstallしたいとき

どのversionがあるか確認してみる。7系以降っぽいね。

brew log elasticsearch-full --oneline

cbe4d0f (HEAD -> master, origin/master, origin/HEAD) Overwrite bundled jdk binaries (#42)
6f3c6c3 (tag: v7.7.0) Update to 7.7.0 artifacts (#40)
5fd77c9 (tag: v7.6.2) Update to 7.6.2 release artifacts (#38)
5f77ab6 (tag: v7.6.1) Update to 7.6.1 artifacts (#34)
8fb53fe (tag: v7.6.0) Update to 7.6.0 release (#31)
bed8bc6 (tag: v7.5.2) Update to 7.5.2 artifacts (#30)
78d845a (tag: v7.5.1) Update to 7.5.1 artifacts (#25)
597389e (tag: v7.5.0) Update to 7.5.0 artifacts (#23)
4754f22 Adapt to bundling JDK into jdk.app (#21)
1ca0727 Resign ML binaries on installation (#20)
c7f585a (tag: v7.4.2) Update to 7.4.2 artifacts (#19)
6dea761 (tag: v7.4.1) Update to 7.4.1 artifacts (#18)
72abe9e Add bottle unneeded to tap formulae (#15)
de55f56 (tag: v7.4.0) Update to 7.4.0 artifacts (#16)
e5862e6 (tag: v7.3.2) Update to 7.3.2 artifacts (#13)
63c9412 (tag: v7.3.1) Update to 7.3.1 artifacts (#12)
4219e4e Fix elasticsearch formula tests (#9)
a134e9c Update to 7.3.0 artifacts
bc6550f Update to 7.2.1 artifacts
9407043 Update to 7.2.0 artifacts
f90d9a3 Initial commit

tapのformulaディレクトリでcheckoutする、例では7.5.0にする。 (余談だけど、標準のformulaは/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/にある)

/usr/local/Homebrew/Library/Taps/elastic/homebrew-tap/Formula
git checkout 597389e elasticsearch-full.rb

brew installするとちゃんと7.5.0をダウンロードしてる

brew install elastic/tap/elasticsearch-full

Updating Homebrew...
==> Installing elasticsearch-full from elastic/tap
==> Downloading https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.0-darwin-x86_64.tar.gz?tap=elastic/homebrew-tap

install終わったらformulaを戻しておく

git reset --hard

ダウングレードしたときにエラーになったのでここ見て直した(brew uninstallしてもdataディレクトリは消してくれなかった模様)

Elasticsearch failed immediately - Elasticsearch - Discuss the Elastic Stack