What is Elasticsearch
Elasticsearch is an open-source, distributed, RESTful search and analytics engine designed for horizontal scalability, reliability, and real-time search capabilities. It is part of the Elastic Stack, formerly known as the ELK Stack (Elasticsearch, Logstash, Kibana), which is widely used for log and data analytics.
Setup Elasticsearch on Mac
Follow the below steps to install or set up Elasticsearch on Mac OS.
Step 1: Download Eelasticsearch
Go to the directory of your choice. Eg cd /Users/venkat/Downloads
Browse https://www.elastic.co/downloads/elasticsearch, Select macOS x86_64
Note: This would have a tarball file with the suffix .tar.gz extension usually referring to the location to download the latest Elasticsearch version.
The downloaded tarball file would be something like the below in the Download location
– rw-r–r–@ 1 venkat staff 421726180 Oct 16 20:31 elasticsearch-8.10.3-darwin-x86_64.tar.gz
Step 2: Unzip Elasticsearch
tar -xzf elasticsearch-8.10.3-darwin-x86_64.tar.gz
tar -xzf elasticsearch-8.10.3-darwin-x86_64.tar.gz
sudo mkdir /usr/local/elasticsearch
sudo mv elasticsearch-8.10.3 /usr/local/elasticsearch
Step 4: Configure Elasticsearch
Edit the elasticsearch.yml configuration file to customize settings such as cluster name, node name, and network host and save changes
cd /usr/local/elasticsearch/elasticsearch-8.10.3/config
Open the elasticsearch.yml file using the vi editor and enter the following and save the file.
cluster.name: my-cluster
node.name: my-node
network.host: 127.0.0.1
Step 5: Run Elasticsearch
Got to the location where you have Elasticsearch installed and run the below command
# Start Elasticsearch
cd /usr/local/elasticsearch/elasticsearch-8.10.3/
.bin/elasticsearch
You should see something like the below on the console or terminal.
Validate Elasticsearch setup
Go to the browser and enter https://localhost:9200/. Note that by default, Elasticsearch uses port:9200 client communication with Elasticsearch. Password would be displayed in the text from the output of starting Elasticsearch(./elasticsearch step 11 above)
username:elastic
Password:xxxxx
Once you see the below click Proceed to localhost(unsafe)
Provide username: elastic password: use the text generated from step11
Below is the confirmation that Elasticsearch version 8.10.3 is successfully installed in Mac.