[Elasticsearch] elasticsearch 啟動錯誤 Cluster name subdirectory exists in data paths
用 homebrew 裝完 elasticsearch 後, 啟動時發生了錯誤
$ elasticsearch
[2019-04-16T17:30:04,562][INFO ][o.e.d.DiscoveryModule ] [-jRyECD] using discovery type [zen] and host providers [settings]
[2019-04-16T17:30:05,151][INFO ][o.e.n.Node ] [-jRyECD] initialized
[2019-04-16T17:30:05,152][INFO ][o.e.n.Node ] [-jRyECD] starting ...
[2019-04-16T17:30:05,462][INFO ][o.e.t.TransportService ] [-jRyECD] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
ERROR: Cluster name [elasticsearch_stan] subdirectory exists in data paths [/usr/local/var/lib/elasticsearch/elasticsearch_stan]. All data under these paths must be moved up one directory to paths [/usr/local/var/lib/elasticsearch]
[2019-04-16T17:30:05,477][INFO ][o.e.n.Node ] [-jRyECD] stopping ...
[2019-04-16T17:30:05,493][INFO ][o.e.n.Node ] [-jRyECD] stopped
[2019-04-16T17:30:05,494][INFO ][o.e.n.Node ] [-jRyECD] closing ...
[2019-04-16T17:30:05,504][INFO ][o.e.n.Node ] [-jRyECD] closed
解決方法:
$ cd /usr/local/Cellar/elasticsearch/6.7.0/libexec/config
$ vim elasticsearch.yml
找到 path.data: /usr/local/var/log/elasticsearch
將其改為 path.data: /usr/local/var/log/elasticsearch_stan
(這邊看你錯誤訊息那邊的名字)
重新執行 $ elasticsearch
重新啟動
成功