DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Installing Elastic Stack in a Single Click Using Docker Compose

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.

Moshe Kaplan user avatar by
Moshe Kaplan
·
Jan. 17, 19 · Tutorial
Like (3)
Save
Tweet
Share
12.32K Views

Join the DZone community and get the full member experience.

Join For Free

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!

Docker (software)

Published at DZone with permission of Moshe Kaplan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • What Is Policy-as-Code? An Introduction to Open Policy Agent
  • Web Application Architecture: The Latest Guide
  • Secrets Management
  • DevOps Roadmap for 2022

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: