DEV Community

Mallikarjun H T
Mallikarjun H T

Posted on • Updated on

The Ultimate Guide to ElasticSearch and Kibana: How to Use and Install with Docker

Welcome to the ultimate guide on ElasticSearch and Kibana! If you're looking for a powerful, open-source tool that can help you search, analyze, and visualize your data like never before, then look no further. In this comprehensive guide, we'll take you through everything you need to know about ElasticSearch and Kibana - from what they are and how they work together to their installation with Docker. Whether you're a developer or just getting started with these tools, get ready to learn everything there is to know about using ElasticSearch and Kibana with Docker in this exciting blog post!

Introduction to Elasticsearch and Kibana

Elasticsearch is a powerful open source search and analytics engine that makes data easy to explore. Kibana is an open source data visualization platform that allows you to interact with your data through beautiful visualizations. In this guide, we'll show you how to use Docker to install and run Elasticsearch and Kibana on your local machine.

What is ElasticSearch?

ElasticSearch is a powerful, open source, distributed search and analytics engine. It is built on top of the Apache Lucene search library and supports full text search, as well as structured data search with SQL-like query syntax. ElasticSearch can be used to power search for websites, applications, and enterprise search solutions. It is also commonly used for log analysis, monitoring, and security analytics.

What is Kibana?

Kibana is an open source data visualization plugin for the Elasticsearch stack. It provides a rich set of tools to help you visualize and explore your data in Elasticsearch. Kibana is a great way to get started with visualizing your data in Elasticsearch.

How to Install ElasticSearch and Kibana with Docker

version: '4.15.0'

services:
  kibana:
    container_name: kb-container
    image: docker.elastic.co/kibana/kibana:7.11.2
    platform: linux/amd64
    environment:
      - ELASTICSEARCH_HOSTS=http://es01:9200
    networks:
      - es-networks
    depends_on:
      - es01
    ports:
      - 5601:5601
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.11.2
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es02,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.elasticsearch.entrypoints=http"
      - "traefik.http.routers.elasticsearch.rule=Host(`localhost`) && PathPrefix(`/es`) || Host(`elasticsearch`)"
      - "traefik.http.routers.elasticsearch.middlewares=es-stripprefix"
      - "traefik.http.middlewares.es-stripprefix.stripprefix.prefixes=/es"
      - "traefik.http.services.elasticsearch.loadbalancer.server.port=9200"
    volumes:
      - es-data-1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - es-networks
  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.11.2
    container_name: es02
    environment:
      - node.name=es02
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.elasticsearch.entrypoints=http"
      - "traefik.http.routers.elasticsearch.rule=Host(`localhost`) && PathPrefix(`/es`) || Host(`elasticsearch`)"
      - "traefik.http.routers.elasticsearch.middlewares=es-stripprefix"
      - "traefik.http.middlewares.es-stripprefix.stripprefix.prefixes=/es"
      - "traefik.http.services.elasticsearch.loadbalancer.server.port=9200"
    volumes:
      - es-data-2:/usr/share/elasticsearch/data
    networks:
      - es-networks
  es03:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.11.2
    container_name: es03
    environment:
      - node.name=es03
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es02
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.elasticsearch.entrypoints=http"
      - "traefik.http.routers.elasticsearch.rule=Host(`localhost`) && PathPrefix(`/es`) || Host(`elasticsearch`)"
      - "traefik.http.routers.elasticsearch.middlewares=es-stripprefix"
      - "traefik.http.middlewares.es-stripprefix.stripprefix.prefixes=/es"
      - "traefik.http.services.elasticsearch.loadbalancer.server.port=9200"
    volumes:
      - es-data-3:/usr/share/elasticsearch/data
    networks:
      - es-networks

networks:
  es-networks:
    driver: bridge

volumes:
  es-data-1:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: 'pathTo/local/file'
  es-data-2:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: 'pathTo/local/file'
  es-data-3:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: 'pathTo/local/file'


Enter fullscreen mode Exit fullscreen mode

Conclusion

We hope this guide has provided you with a comprehensive overview of ElasticSearch and Kibana and how to install them with Docker. With the right configuration, installing and running these two powerful tools can be relatively straightforward. Once installed, you will be able to take advantage of their many features that make searching through large data sets easier than ever before. Whether you are building a search engine or just need an efficient way to manage your data, ElasticSearch and Kibana have something for everyone.

Top comments (0)