ElasticSearch Installation

(Last Updated On: )

To install ElasticSearch is really straight forward. I will be using Ubuntu 16.04 for this installation.

Java 8

java -version
#if not installed run the following
sudo apt-get install openjdk-8-jdk

Download

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.rpm

Directories

It is recommended to change the log and data directory from default implementations.

#create log and data directory
sudo mkdir /my/dir/log/elasticsearch
sudo mkdir /my/dir/elasticsearch

# Change owner
sudo chown -R elasticsearch /my/dir/log/elasticsearch
sudo chown -R elasticsearch /my/dir/elasticsearch

Install

sudo rpm -ivh elasticsearch-6.2.3.rpm

Change Settings

sudo vi /etc/elasticsearch/elasticsearch.yml

#Change the following settings
#----------SETTINGS-----------------
cluster.name: logsearch
node.name: ##THE_HOST_NAME##
node.master: true #The node is master eligable
node.data: true #Hold data and perform data related operations
path.data: /my/dir/elasticsearch
path.logs: /my/dir/log/elasticsearch
network.host: ##THE_HOST_NAME##
http.port: 9200
discovery.zen.ping.unicast.hosts: ["##THE_HOST_NAME##"]
#----------SETTINGS-----------------

Start/Stop/Status ElasticSearch

sudo service elasticsearch start
sudo service elasticsearch stop
sudo service elasticsearch status

Rest API

http://localhost:9200