Skip to content

Instantly share code, notes, and snippets.

@patrickdappollonio
Last active October 16, 2019 23:18
Show Gist options
  • Save patrickdappollonio/2ba2620f07b5cf3bfb92146764804a58 to your computer and use it in GitHub Desktop.
Save patrickdappollonio/2ba2620f07b5cf3bfb92146764804a58 to your computer and use it in GitHub Desktop.
Run a temporary, development-only elasticsearch cluster with 2 nodes

Run a temporary, development-only elasticsearch cluster with 2 nodes

Must run:

sysctl -w vm.max_map_count=262144

Then with docker-compose:

version: '2.2'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0
    container_name: es01
    environment:
      - node.name=es01
      - discovery.seed_hosts=es02
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0
    container_name: es02
    environment:
      - node.name=es02
      - discovery.seed_hosts=es01
      - cluster.initial_master_nodes=es01,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata02:/usr/share/elasticsearch/data
    networks:
      - esnet

volumes:
  esdata01:
    driver: local
  esdata02:
    driver: local

networks:
  esnet:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment