• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Install and configure elasticsearch cluster on Ubuntu 14.04 LTS

March 22, 2015 by Sharad Chhetri

Elasticsearch is a popular search server based on Lucene. It is well developed in Java and with awesomeness of Open source, it is available to all. In this tutorial we will talk about how to install and configure elasticsearch cluster on Ubuntu 14.04 LTS.

Details Of Elasticsearch Cluster Architecture

Operating System : Ubuntu 14.04 LTS Server Edition
Network : AWS Cloud Computing
Package Name and version : elasticsearch-1.4.4
No. of Servers : 2
elasticnode01 = 172.31.49.78 (Name of server)
elasticnode02 = 172.31.63.200 (Name of server)
Ports opened in both servers :

Port Number Source Destination
9100 elasticnode01 elasticnode02
9200 elasticnode01 elasticnode02
9300 elasticnode01 elasticnode02
9100 elasticnode02 elasticnode01
9200 elasticnode02 elasticnode01
9300 elasticnode02 elasticnode01

elastic

Prerequisite

1. Java

Install and configure elasticsearch

In this section we will practically implement the 2 node elasticsearch cluster. You can increase the server count from 2 to any as per your requirement.

NOTE: The given below steps are implementing on elasticnode01 & elasticnode02.

Step 1. Install Java on both server – elasticnode01 and elasticnode02 .

You can follow our guide to install Java on Ubuntu in case if it is not in your system. We are using the jdk-1.8 in this practical.

Install and set Java on Ubuntu 14.04 LTS with tar ball file

Step 2. Login into your system and switch to superuser by given below command.
In both server – elasticnode01 and elasticnode02

sudo su -

Step 3. In both server – elasticnode01 and elasticnode02 download latest elastic search package from their website.

We have downloaded the package elasticsearch-1.4.4 on our system with wget command.

wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.4.tar.gz

Step 4. In both server elasticnode01 and elasticnode02 , extracting downloaded elasticsearch package file (elasticsearch-1.4.4.tar.gz) into /opt directory.

The package will be extracted to /opt .

tar -xvzf elasticsearch-1.4.4.tar.gz  -C /opt/

Step 5. In both server elasticnode01 and elasticnode02 , edit the /etc/hosts file and map the both servers ip address . Replace the below given ip addresses with your server’s ip addresses.

vi /etc/hosts
172.31.49.78 elasticnode01
172.31.63.200 elasticnode02

Step 6. In both server elasticnode01 and elasticnode02, change to directory where elasticsearch package you have extracted out.

cd /opt/elasticsearch-1.4.4

Step 7. Edit config/elasticsearch.yml file and update the given below parameters.

In Server elasticnode01 :

vi config/elasticsearch.yml
cluster.name: mycluster
node.name: "elasticnode01"
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["elasticnode02"]

In Server elasticnode02 :

vi config/elasticsearch.yml
cluster.name: mycluster
node.name: "elasticnode02"
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["elasticnode01"]

Step 8 . Start the elasticsearch server. Use the command in both server – elasticnode01 and elasticnode02 .

nohup /opt/elasticsearch-1.4.4/bin/elasticsearch -p /opt/elasticsearch-1.4.4/elasticsearch.pid  > elasticsearch.out 2> elasticsearch.error < /dev/null & 

Step 9. Checking cluster through command line . You can run from any node server (elasticnode01 / elasticnode02).

checking cluster health -

curl 'localhost:9200/_cat/health?v'

checking node status in cluster -

curl 'localhost:9200/_cat/nodes?v'

Given below is reference from our servers -

root@ip-172-31-63-200:/opt/elasticsearch-1.4.4# curl 'localhost:9200/_cat/health?v'
epoch      timestamp cluster   status node.total node.data shards pri relo init unassign 
1427039801 15:56:41  mycluster green           2         2      0   0    0    0        0 
root@ip-172-31-63-200:/opt/elasticsearch-1.4.4# 

root@ip-172-31-63-200:/opt/elasticsearch-1.4.4# curl 'localhost:9200/_cat/nodes?v'
host             ip            heap.percent ram.percent load node.role master name          
ip-172-31-49-78  172.31.49.78             4          27 0.00 d         *      elasticnode01 
ip-172-31-63-200 172.31.63.200            4          27 0.00 d         m      elasticnode02 
root@ip-172-31-63-200:/opt/elasticsearch-1.4.4# 

Step 10. Putting some sample indices for testing. We have taken reference from Elasticsearch site.
You can run command from any node because the data will be put and get from both servers.

Create index:

curl -XPUT 'localhost:9200/customer?pretty'

Put information into our customer index:

curl -XPUT 'localhost:9200/customer/external/1?pretty' -d '
{
  "name": "John Doe"
}'

List all indexes:

curl 'localhost:9200/_cat/indices?v'

Step 11. Installing useful plugin for GUI. Install the plugin in both server that is elasticnode01 and elasticnode02 .

(a) elasticsearch-head : A web front end for an Elasticsearch cluster

cd /opt/elasticsearch-1.4.4
bin/plugin --install mobz/elasticsearch-head

You can see elasticsearch-head web interface in web browser -
http://ip-address-node:9200/_plugin/head

Screenshot of elasticsearch-head.
ECS-1

(a) Bigdesk : Installing bigdesk plugin in both servers.

cd /opt/elasticsearch-1.4.4
bin/plugin --install lukas-vlcek/bigdesk

Open bigdesk in web browser -
http://ip-address-node:9200/_plugin/bigdesk/

Screenshot of elasticsearch-bigdesk.
bigdesk

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to install and configure FTP server in Ubuntu 12.04 LTS
  2. How to install and configure Secure FTP server in Ubuntu 12.04 LTS
  3. How to install and configure FTP server with chroot in Ubuntu 12.04 LTS
  4. Install and configure nagios core 4 on Ubuntu 12.04 LTS
  5. How to install and configure vncserver in Ubuntu
  6. How to install and configure nagios nrpe client in Ubuntu with apt-get command
  7. Upgrade Ubuntu 14.04 LTS to Ubuntu 14.04.3 LTS
  8. How to configure self signed SSL certificate in owncloud Ubuntu
  9. How to configure static ip address through command line in Ubuntu
  10. How to configure multiple mysql instance in Ubuntu

Filed Under: Linux Tagged With: search server

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

convert space into new line using sed command

SSH WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED

Show visitor ip address php code

Learn Linux Date Command With Examples

How to see system load average in terminal with graphical representation

How to hide php version information in header

Forgot root password ,Reset it in Run level 1

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy