There are many ways to install Elasticsearch and Kibana but we will use docker-compose because installation of Elasticsearch and Kibana using docker-compose makes it Operating system agnostic. You will be creating two docker services

  • Elasticsearch
  • Kibana
Elasticsearch and Kibana Docker compose

Create the docker-compose file

touch elastic-search-kibana-docker-compose.yaml

This will create the elastic-search-kibana-docker-compose.yaml file and then you can define the docker services inside this file.

Define Elasticsearch and Kibana service

version: '3.7'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0
    container_name: elasticsearch
    restart: always
    environment:
      - xpack.security.enabled=false
      - discovery.type=single-node
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
      cap_add:
        - IPC_LOCK
    volumes:
      - elasticsearch-data-volume:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300

  kibana:
    container_name: kibana
    image: docker.elastic.co/kibana/kibana:7.4.0
    restart: always
    environment:
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
    ports:
      - 5601:5601
    depends_on:
      - elasticsearch

volumes:
  elasticsearch-data-volume:
  driver: local

This will create Two docker service

  • Elasticsearch
    • Elasticsearch is exposing two ports 9200 and 9300
    • we are using docker.elastic.co/elasticsearch/elasticsearch:7.4.0 docker image.
  • Kibana
    • Kibana is exposing 5601 port
    • we are pointing Kibana to Elasticsearch using the ELASTICSEARCH_HOSTS configuration
      • The address of Elasticsearch is provided as http://elasticsearch:9200

The data stored in the Elastisearch is safe because we are using volume and it is persistent in nature

Start the Elasticsearch and Kibana services

docker-compose -f elastic-search-kibana-docker-compose.yaml up

This will start the container in foreground mode where all the logs will be printed on the console and if you exit the console then all the docker services will shut down.

If you want to start the services in background mode then you can use the -d option which is called daemon mode

docker-compose -f elastic-search-kibana-docker-compose.yaml up -d

Access Kibana

open the below URL in your browser

http://your-machine-ip-address:5601

Note: You need to use your machine’s IP Address

References

Next: Data Pipeline using Kafka, Elasticsearch, Kibana and Logstash

Leave a Reply

Your email address will not be published. Required fields are marked *