How To Install Elasticsearch On Mac ?

0
2860

ElasticSearch

This article explains the steps to install 1.prerequisite of elasticsearch, 2.elasticsearch, 3.elasticsearch plugins and 4.index a document in elasticsearch, on Mac OS X Yosemite 10.10.1.


 

Step-1: Install Homebrew ( Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with OS X.) refer : http://brew.sh ( Ruby is preInstalled with MAC).

Type the command :

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

If you have already installed brew then ignore first step.


 

Step-2:Install elasticsearch

If wrong command entered :(see the space between elastic and search)

Sumits-MacBook-Pro:~ eSumit$ brew install elastic search
Error: No available formula for elastic
==> Searching formulae…
aws-elasticache aws-elasticbeanstalk elasticsearch
==> Searching taps…
^C

If right command entered :

Sumits-MacBook-Pro:~ eSumit$ brew install elasticsearch
==> Downloading https://download.elastic.co/elasticsearch/elasticsearch/elastics
######################################################################## 100.0%
==> Caveats
Data: /usr/local/var/elasticsearch/elasticsearch_eSumit/
Logs: /usr/local/var/log/elasticsearch/elasticsearch_eSumit.log
Plugins: /usr/local/var/lib/elasticsearch/plugins/
Config: /usr/local/etc/elasticsearch/

To have launchd start elasticsearch at login:
mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
Then to load elasticsearch now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
Or, if you don’t want/need launchctl, you can just run:
elasticsearch –config=/usr/local/opt/elasticsearch/config/elasticsearch.yml
==> Summary
/usr/local/Cellar/elasticsearch/1.7.1: 34 files, 30M, built in 96 seconds

{

Also check If java already installed on your MAC

Sumits-MacBook-Pro:Documents eSumit$ java -version
java version “1.8.0_45”
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
Sumits-MacBook-Pro:Documents eSumit$

}


Step-3 : Run ElasticSearch

type this command on terminal

elasticsearch –config=/usr/local/opt/elasticsearch/config/elasticsearch.yml

Sumits-MacBook-Pro:Documents eSumit$ elasticsearch –config=/usr/local/opt/elasticsearch/config/elasticsearch.yml
[2015-11-16 00:43:21,403][INFO ][node ] [Thirty-Three] version[1.7.1], pid[972], build[b88f43f/2015-07-29T09:54:16Z]
[2015-11-16 00:43:21,403][INFO ][node ] [Thirty-Three] initializing …
[2015-11-16 00:43:21,481][INFO ][plugins ] [Thirty-Three] loaded [], sites [head, HQ]
[2015-11-16 00:43:21,516][INFO ][env ] [Thirty-Three] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [354.3gb], net total_space [464.6gb], types [hfs]
[2015-11-16 00:43:24,557][INFO ][node ] [Thirty-Three] initialized
[2015-11-16 00:43:24,557][INFO ][node ] [Thirty-Three] starting …
[2015-11-16 00:43:24,877][INFO ][transport ] [Thirty-Three] bound_address {inet[/127.0.0.1:9300]}, publish_address {inet[/127.0.0.1:9300]}
[2015-11-16 00:43:24,982][INFO ][discovery ] [Thirty-Three] elasticsearch_eSumit/fm7KR4W2RwSgSUK1463qvw
[2015-11-16 00:43:28,915][INFO ][cluster.service ] [Thirty-Three] new_master [Thirty-Three][fm7KR4W2RwSgSUK1463qvw][Sumits-MacBook-Pro.local][inet[/127.0.0.1:9300]], reason: zen-disco-join (elected_as_master)
[2015-11-16 00:43:28,965][INFO ][http ] [Thirty-Three] bound_address {inet[/127.0.0.1:9200]}, publish_address {inet[/127.0.0.1:9200]}
[2015-11-16 00:43:28,965][INFO ][node ] [Thirty-Three] started
[2015-11-16 00:43:29,014][INFO ][gateway ] [Thirty-Three] recovered [0] indices into cluster_state


 

Step-4 : Type http://127.0.0.1:9200/ at your browser

You will get the result :

{
“status” : 200,
“name” : “Thirty-Three”,
“cluster_name” : “elasticsearch_eSumit”,
“version” : {
“number” : “1.7.1”,
“build_hash” : “b88f43fc40b0bcd7f173a1f9ee2e97816de80b19”,
“build_timestamp” : “2015-07-29T09:54:16Z”,
“build_snapshot” : false,
“lucene_version” : “4.10.4”
},
“tagline” : “You Know, for Search”
}
Or type curl command on terminal :

Sumits-MacBook-Pro:bin eSumit$ curl -X GET http://localhost:9200
{
“status” : 200,
“name” : “Thirty-Three”,
“cluster_name” : “elasticsearch_eSumit”,
“version” : {
“number” : “1.7.1”,
“build_hash” : “b88f43fc40b0bcd7f173a1f9ee2e97816de80b19”,
“build_timestamp” : “2015-07-29T09:54:16Z”,
“build_snapshot” : false,
“lucene_version” : “4.10.4”
},
“tagline” : “You Know, for Search”
}


 

Step-5: Install ElasticSearch Plugins

Step-5.1 : Install elasticsearch hq plugin (refer : http://www.elastichq.org/support_plugin.html)

Go to elasticsearch directory from your terminal:

Sumits-MacBook-Pro:~ eSumit$ cd /usr/local/bin/
Sumits-MacBook-Pro:bin eSumit$ ls
brew elasticsearch randpkt
capinfos elasticsearch.in.sh rawshark
dftest jmeter text2pcap
dumpcap mergecap tshark
editcap plugin wireshark
Sumits-MacBook-Pro:bin eSumit$

Step-5.2: Download the elasticsearch hq from plugin command

Sumits-MacBook-Pro:bin eSumit$ plugin -install royrusso/elasticsearch-HQ
-> Installing royrusso/elasticsearch-HQ…
Trying https://github.com/royrusso/elasticsearch-HQ/archive/master.zip…
Downloading ……………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………..DONE
Installed royrusso/elasticsearch-HQ into /usr/local/var/lib/elasticsearch/plugins/HQ
Identified as a _site plugin, moving to _site structure …
Sumits-MacBook-Pro:bin eSumit$

Step-5.3: Enter the URL to the browser: http://127.0.0.1:9200/_plugin/hq/

You will see following in browser:

See Elastic Search Plugin to Browser

For more information on plugins refer :
https://www.elastic.co/guide/en/elasticsearch/plugins/2.0/intro.html
https://blog.codecentric.de/en/2014/03/elasticsearch-monitoring-and-management-plugins/

Step-5.4 : Click on Connect on top left , and then it will show the following :

On Click to Connect Elastic HQ Plugin browser view


 

Step-6: Insert a record into ElasticSearch 

{http://localhost:9200/<index>/<type>/[<id>]}

Sumits-MacBook-Pro:bin eSumit$ curl -XPUT ‘http://localhost:9200/twitter/tweet/1’ -d ‘{
“user” : “testEsumit”,
“post_date” : “2009-11-15T14:12:12”,
“message” : “trying out Elasticsearch”
}’

{ Response }

{“_index”:”twitter”,”_type”:”tweet”,”_id”:”1″,”_version”:2,”created”:false}
refer : https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html

Step-6.1: Go to the browser and see the following (see the Twitter record added under indicies):

Elastic Search HQ Plugin show Twitter Record

 


 

Refer further ElasticSearch’s ‘Getting Started’ Resources

Elasticsearch used by several websites to power the search experience

Example : www.autoscount24.com (refer : https://www.elastic.co/use-cases/autoscout24)

How to interact with data in ealsticsearch using crud operations?

https://www.digitalocean.com/community/tutorials/how-to-interact-with-data-in-elasticsearch-using-crud-operations

Getting Started with ElasticSearch 

http://www.javacodegeeks.com/2013/04/getting-started-with-elasticsearch.html

Getting Started Tutorial

http://joelabrahamsson.com/elasticsearch-101/

SHARE
Previous articleHow You Rate Yourself In Linux And Networking Technology ?
Next articleDevice Monitoring - Java, REST CXF, MongoDB, Maven,Tomcat
Since last 15 years in different geographical locations, Sumit prepared hiring format for several hiring managers/teams to hire the balanced talents and interviewed talents on the various stages of their selection process. He also interviewed by hundreds of companies in different geographical locations.His best conclusion for hiring teams and candidate is to prepare in advance. Here ‘advance’ means keep your interview book ready and continue to update it even you are not going to interview candidates or applying for any job in next six months.