Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Installing Elastic Stack in a Single Click Using Docker Compose

DZone's Guide to

Installing Elastic Stack in a Single Click Using Docker Compose

Learn how to quickly and easily get the Elastic Stack running ion your machine using the most popular container technology out there.

· Big Data Zone ·
Free Resource

The Architect’s Guide to Big Data Application Performance. Get the Guide.

The Elastic team did a great job packaging the various Elastic Stack compnents into Docker images.

Yet, this manual will help you boot the entire stack including Logstash and Kibana in a single click using Docker Compose.

1. Run the following command in your host machine 

 sudo sysctl -w vm.max_map_count=262144 

2. Install Docker Compose

In ubuntu for example use:

sudo apt-get -y install docker-compos

3. Create a docker-compose.yml file and copy the docker-compose.yml to your machine:

version: '2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.4.2
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 1g
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
  elasticsearch2:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.4.2
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=elasticsearch1"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 1g
    volumes:
      - esdata2:/usr/share/elasticsearch/data
    networks:
      - esnet
  kibana:
    image: docker.elastic.co/kibana/kibana:5.4.2
    ports:
      - 5601:5601
    networks:
      - esnet
  logstash:
    image: docker.elastic.co/logstash/logstash:5.4.2
    volumes:
      - /tmp/pipeline:/usr/share/logstash/pipeline/
      - /tmp/input:/tmp/input
    networks:
      - esnet
volumes:
  esdata1:
    driver: local
  esdata2:
    driver: local
networks:
  esnet:

4. Start the cluster

sudo docker-compose up

 

5. Verify the cluster using the password changeme

 curl -u elastic http://127.0.0.1:9200/_cat/health Enter host password for user 'elastic': 1498046576 12:02:56 docker-cluster green 2 2 12 6 0 0 0 0 - 100.0%

6. And Kibana using 

http://127.0.0.1:5601

Bottom Line

Docker changes the DevOps world as we know it, and complex tasks that took hours, can be done in few clicks

#!/bin/sh

#Set virtual memory
sudo sysctl -w vm.max_map_count=262144

#Get the docker-compose.yml
wget https://gist.githubusercontent.com/mosheka/4122218b8a32f9213c48c1c999c214e8/raw/54591b6d692a3b3fefd13c77a1fcf5640e4e3ddc/docker-compose.yml
#Start it
sudo docker-compose up

Keep performing!

Learn how taking a DataOps approach will help you speed up processes and increase data quality by providing streamlined analytics pipelines via automation and testing. Learn More.

Topics:
big data ,elastic stack ,docker images ,docker tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}