How to Install Or Upgrade Elastic Search on Mac OS ?

How to Install Or Upgrade Elastic Search on Mac OS ?

Elastic Search Installation Notes on MacOS, Initially installed Version 2.4.0 on OS X Yosemite 10.10.1, and now upgraded to 5.6.2 with OS X Sierra 10.12.5

Previous Installation Steps Elastic Search 2.4.0 On OS X Yosemite 10.10.1

Elastic search used by several websites to power the search experience e.g. www.autoscount24.com (refer : https://www.elastic.co/use-cases/autoscout24), and you have decided that complete job market into the web area, so to get the expertise into it.
Now on your first step and would like to install it on your 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)"
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 write command entered :
Sumits-MacBook-Pro:~ eSumit$ brew install elasticsearch ==> Downloading https://download.elastic.co/elasticsearch/elasticsearch/elastics######################################################################## 100.0%==> CaveatsData:    /usr/local/var/elasticsearch/elasticsearch_eSumit/Logs:    /usr/local/var/log/elasticsearch/elasticsearch_eSumit.logPlugins: /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/LaunchAgentsThen to load elasticsearch now:  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plistOr, 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 -versionjava 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 
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"}Sumits-MacBook-Pro:bin eSumit$ 
Step-5: Install ElasticSearch Plugins 
Step-5.1 : Install elasticsearch hq plugin (refer : http://www.elastichq.org/support_plugin.html)
Go to elasticsearch directory :
Sumits-MacBook-Pro:~ eSumit$ cd /usr/local/bin/Sumits-MacBook-Pro:bin eSumit$ lsbrew elasticsearch randpktcapinfos elasticsearch.in.sh rawsharkdftest jmeter text2pcapdumpcap mergecap tsharkeditcap plugin wiresharkSumits-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 .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONEInstalled royrusso/elasticsearch-HQ into /usr/local/var/lib/elasticsearch/plugins/HQIdentified 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/

Step-6: Insert a record into ElasticSearch 
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"}'{"_index":"twitter","_type":"tweet","_id":"1","_version":2,"created":false}Sumits-MacBook-Pro:bin eSumit$ 

refer : https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch/bin$ ./elasticsearch --versionVersion: 2.4.0, Build: ce9f0c7/2016-08-29T09:14:17Z, JVM: 1.8.0_45

ElasticSearch upgraded to 5.6.2 with OS X Sierra 10.12.5

Error: elasticsearch 2.4.0 is already installedTo upgrade to 5.6.2, run `brew upgrade elasticsearch`eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch$ 

eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch/config$ elasticsearch --config=/usr/local/opt/elasticsearch/config/elasticsearch.yml[2017-10-03 16:23:31,375][INFO ][bootstrap                ] es.config is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed.

eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch$ brew upgrade elasticsearch==> Upgrading 1 outdated package, with result:elasticsearch 5.6.2==> Upgrading elasticsearch ==> Downloading https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.2.tar.gz######################################################################## 100.0%==> CaveatsData:    /usr/local/var/elasticsearch/elasticsearch_eSumit/Logs:    /usr/local/var/log/elasticsearch/elasticsearch_eSumit.logPlugins: /usr/local/opt/elasticsearch/libexec/plugins/Config:  /usr/local/etc/elasticsearch/plugin script: /usr/local/opt/elasticsearch/libexec/bin/elasticsearch-plugin
To have launchd start elasticsearch now and restart at login:  brew services start elasticsearchOr, if you don't want/need a background service you can just run:  elasticsearch==> Summary🍺  /usr/local/Cellar/elasticsearch/5.6.2: 104 files, 35.9MB, built in 27 seconds
Elastic Search 5.6 Location :
eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch$ cd ..eSumit@Sumits-MacBook-Pro:/usr/local/opt$ lsautoconf@          elasticsearch@     icu4c@             mysql@             node@6@            protobuf@          redis@automake@          elasticsearch@5.6@ jmeter@            nmap@              openssl@           protobuf260@       yarn@cmake@             gradle@            mongoose@          node@              openssl@1.0@       protobuf@2.6@eSumit@Sumits-MacBook-Pro:/usr/local/opt$ 

On Error :
please check that any required plugins are installed, or check the breaking changes documentation for removed settings

eSumit@Sumits-MacBook-Pro:/usr/local/opt$ elasticsearch --version

Version: 5.6.2, Build: 57e20f3/2017-09-23T13:16:45.703Z, JVM: 1.8.0_45eSumit@Sumits-MacBook-Pro:/usr/local/opt$ 

eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6$ lsINSTALL_RECEIPT.json               NOTICE.txt                         bin/                               libexec/LICENSE.txt                        README.textile                     homebrew.mxcl.elasticsearch.plisteSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6$ cd bineSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6/bin$ lselasticsearch*        elasticsearch-plugin*eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6/bin$ ./elasticsearch-plugin install analysis-icu-> Downloading analysis-icu from elastic[=================================================] 100%   -> Installed analysis-icueSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6/bin$ 

eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6$ cd libexec/eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6/libexec$ lsbin/     config@  lib/     modules/ plugins/eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6/libexec$ cd configeSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6/libexec/config$ lselasticsearch.yml          jvm.options                logging.yml                scripts/elasticsearch.yml.default  log4j2.properties          logging.yml.default

eSumit@Sumits-MacBook-Pro:/usr/local/var/lib$ cd ..eSumit@Sumits-MacBook-Pro:/usr/local/var$ lsdb/            homebrew/      log/           run/elasticsearch/ lib/           mysql/eSumit@Sumits-MacBook-Pro:/usr/local/var$ cd elasticsearch/eSumit@Sumits-MacBook-Pro:/usr/local/var/elasticsearch$ lselasticsearch_eSumit/eSumit@Sumits-MacBook-Pro:/usr/local/var/elasticsearch$ cd elasticsearch_eSumit/eSumit@Sumits-MacBook-Pro:/usr/local/var/elasticsearch/elasticsearch_eSumit$ lsnodes/eSumit@Sumits-MacBook-Pro:/usr/local/var/elasticsearch/elasticsearch_eSumit$ lsnodes/eSumit@Sumits-MacBook-Pro:/usr/local/var/elasticsearch/elasticsearch_eSumit$ cd nodeseSumit@Sumits-MacBook-Pro:/usr/local/var/elasticsearch/elasticsearch_eSumit/nodes$ ls0/eSumit@Sumits-MacBook-Pro:/usr/local/var/elasticsearch/elasticsearch_eSumit/nodes$ 
eSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6/libexec/plugins$ pwd/usr/local/opt/elasticsearch@5.6/libexec/pluginseSumit@Sumits-MacBook-Pro:/usr/local/opt/elasticsearch@5.6/libexec/plugins$
elastic search 5.6.2 running fine on command line
elastic search 5.6.2 running fine on command line
ElasticSearch 5.6.2 Running on Mac Os Sierra
ElasticSearch 5.6.2 Running on Mac Os Sierra

On this issue :

unknown setting [path.plugins] please check that any required plugins are installed, or check the breaking changes documentation for removed settings

Go to elasticsearch.yml file, and see the path settings, it may refer to previous installation.

elasticsearch.yml file fixing path issues
elasticsearch.yml file fixing path issues

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s