Difference between revisions of "Docker: ElasticSearch"

From RHS Wiki
Jump to navigation Jump to search
(Created page with "docker-compose.yml<syntaxhighlight lang="docker"> version: '2.2' services: es01: image: docker.elastic.co/elasticsearch/elasticsearch:7.0.0 container_name: es01...")
Tag: visualeditor
 
m
Tag: visualeditor
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
docker-compose.yml<syntaxhighlight lang="docker">
+
[https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html docker-compose.yml]<syntaxhighlight lang="docker">
 
version: '2.2'
 
version: '2.2'
 
services:
 
services:
Line 50: Line 50:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Bring the cluster up & down ===
+
===Bring the cluster up & down===
<syntaxhighlight lang="bash">
+
Requires vm.max_map_count = 262144 ( <syntaxhighlight lang="bash">
 +
sudo sysctl -w vm.max_map_count=262144 && echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf
 +
</syntaxhighlight><syntaxhighlight lang="bash">
 
docker-compose up
 
docker-compose up
 
docker-compose down
 
docker-compose down
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Inspect status of cluster ===
+
===Inspect status of cluster===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
curl http://127.0.0.1:9200/_cat/health
 
curl http://127.0.0.1:9200/_cat/health
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 09:04, 15 April 2019

docker-compose.yml

version: '2.2'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.0.0
    container_name: es01
    environment:
      - node.name=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:
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.0.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:

Bring the cluster up & down[edit]

Requires vm.max_map_count = 262144 (

sudo sysctl -w vm.max_map_count=262144 && echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf
docker-compose up
docker-compose down

Inspect status of cluster[edit]

curl http://127.0.0.1:9200/_cat/health