[Recipes] Install Elasticsearch and Kibana in Local Machine

Problem: 

Provide steps to install and configure Elasticsearch and kibana in local.

If you are getting started with Elasticsearch I strongly recommend getting started on the free trial available at Elastic Cloud, and skip this recipe. You may also use the Amazon ES free tier if you already have an AWS free tier account. However, for any reason you want to install and configure Elasticsearch in your local machine, you may continue with this recipe.

Solution Summary: 

In this lab, we will download and install ElasticSearch in a Windows Machine. In a Linux machine, you should be able to do the same from OS package manager (e.g. Debian or RPM packages). 

Alternatively you can install Elasticsearch with Docker

However, I recommend you try it out in Elastic Cloud. It is free for 14 days and you do not have to enter a credit card as well.

Prerequisites: 

Java should have been installed, preferably the latest version. 

Solution Steps: 

  1. Install ElasticSearch

    1. Download ElasticSearch from https://www.elastic.co/downloads/elasticsearchand extract it.

    2. Run: bin\elasticsearch.bat

    3. Run: curl http://localhost:9200/ (See Sample Output 1)

    4. Note: Latest steps should be present in the download page.

  2. Override the cluster or node name

    1. Stop server

    2. Run: bin\elasticsearch.bat -Ecluster.name=buddy_cluster -Enode.name=buddy_node

    3. Run: curl http://localhost:9200/  (See Sample Output 2)

  3. Install Kibana to visualize your Elasticsearch data and navigate the Elastic Stack:

    1. Download (and extract) from https://www.elastic.co/downloads/kibana

    2. Open Open config/kibana.yml and Set elasticsearch.url to point at your Elasticsearch instance. Default is http://localhost:9200/, but you will need to uncomment the line.

    3. Run: bin\kibana.bat

      1. May see a message: Optimizing and caching bundles for kibana, timelion and status_page. This may take a few minutes. It may then print some additional statements and finally it will print: Status changed from yellow to green – Ready.

    4. Run from browser: http://localhost:5601

      1. Kibana will be loaded and you should see a message to configure an index pattern: in order to use Kibana you must configure at least one index pattern. Index patterns are used to identify the Elasticsearch index to run search and analytics against. They are also used to configure fields.

    5. Run the ‘GET /_cat/health?v’ API call from Kibana console, going to the Dev Tools tab.

    6. Run the ‘GET /_cat/nodes?v’ API call from Kibana console, to see the list of nodes.

    7. Run the ‘GET /_cat/nodes?v’ API call from Kibana console, to see the list of indices.

      1. Gives output similar to: yellow open   .kibana FWELCuIbRRmf4LVVCOTpHQ   1   1          1            0      3.1kb          3.1kb. Or nothing at all.  

 

Notes

  1. By default, Elasticsearch uses port 9200 to provide access to its REST API. This port is configurable if necessary.

  2. Kibana lets you visualize your Elasticsearch data and navigate the Elastic Stack.

  3. Whenever we ask for the cluster health, we either get green, yellow, or red. Green means everything is good (cluster is fully functional), yellow means all data is available but some replicas are not yet allocated (cluster is fully functional), and red means some data is not available.

 

Sample Outputs

Output 1: Run: curl http://localhost:9200/ - Default ES Start

{

  "name" : "72RGNuX",

  "cluster_name" : "elasticsearch",

  "cluster_uuid" : "DZEhGZRlRqSvqKwjuRwDAg",

  "version" : {

    "number" : "5.4.1",

    "build_hash" : "2cfe0df",

    "build_date" : "2017-05-29T16:05:51.443Z",

    "build_snapshot" : false,

    "lucene_version" : "6.5.1"

  },

  "tagline" : "You Know, for Search"

}

 

Output 2: Run: curl http://localhost:9200/- Custom ES Start

{

  "name" : "buddy_node",

  "cluster_name" : "buddy_cluster",

  "cluster_uuid" : "DZEhGZRlRqSvqKwjuRwDAg",

  "version" : {

    "number" : "5.4.1",

    "build_hash" : "2cfe0df",

    "build_date" : "2017-05-29T16:05:51.443Z",

    "build_snapshot" : false,

    "lucene_version" : "6.5.1"

  },

  "tagline" : "You Know, for Search"

}

Recipe Tags: 

Learn Serverless from Serverless Programming Cookbook

Contact

Please first use the contact form or facebook page messaging to connect.

Offline Contact
We currently connect locally for discussions and sessions at Bangalore, India. Please follow us on our facebook page for details.
WhatsApp (Primary): (+91) 7411174113
Phone (Escalations): (+91) 7411174114

Business newsletter

Complete the form below, and we'll send you an e-mail every now and again with all the latest news.

About

CloudMaterials is my blog to share notes and learning materials on Cloud and Data Analytics. My current focus is on Microsoft Azure and Amazon Web Services (AWS).

I like to write and I try to document what I learn to share with others. I believe that knowledge is useless unless you share it; the more you share, the more you learn.

Recent comments

Photo Stream