Run Elasticsearch 7 with Homebrew
October 30, 2019I've had some trouble getting Elasticsearch 7.x running on my Mac, due to the default configuration not working as is. Here's what I did to get it working.
Install the Official Release
Note that 7.x
has not been released on the official Homebrew repository yet,
mainly because it seems to conflict with some other packages.
So you might not necessarily want to run 7.x
.
If you do, make sure to remove your existing Elasticsearch instance:
brew services stop elasticsearch
brew uninstall elasticsearch
And delete all your existing data (assuming it is not important):
rm -rf /usr/local/var/lib/elasticsearch/
Elasticsearch offers its own Homebrew tap for Elasticsearch, which can be installed as follows:
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
Fix the Configuration
After installing Elasticsearch, it won't start without some configuration
changes. I had to set xpack.ml.enabled: false
in my elasticsearch.yml
.
You can find the config in /usr/local/etc/elasticsearch/
.
The full config that I use is as follows:
# may be master and may hold data node.name: elasticsearch node.master: true node.data: true node.ml: false xpack.ml.enabled: false # Elasticsearch has no security whatsoever, do not expose to 0.0.0.0! network.host: localhost # node communication transport.tcp.port: 9300 # rest api http.port: 9200 # run as single node discovery.type: single-node # Disable auto creation of indices (except for some which Elasticsearch requires) action.auto_create_index: ".security*,.monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*"
Of course your requirements may vary, so things like index auto creation might look different on your instance. But at least this gets the instance running with the following command:
elasticsearch
Or in the background:
brew services start elasticsearch