I am new to Elasticsearch and currently trying to setup a multi-node Elasticsearch cluster environment using docker in my local machine. When cluster comes up, it status is green (checked using "/_cluster/health" api, however it has only one node in it whereas I am trying to create 3 nodes cluster. Below is the docker-compose.yml for the same. Note that in below docker-compose file, I am mapping the index volume to each node using unique directories and expecting that when 3 node cluster come sup, this index gets distributed across shards on multiple nodes.
version: '3.3'
services:
elasticsearch01:
image: dockerregistry.homeoffice.anfcorp.com/vendor/elasticsearch/elasticsearch:7.8.0
ports:
- "9200:9200"
environment:
cluster.name: "docker-cluster"
node.name: "elasticsearch01"
discovery.seed_hosts: "elasticsearch02"
network.host: 0.0.0.0
indices.query.bool.max_clause_count: 100000
transport.tcp.port: 9300
cluster.initial_master_nodes: "elasticsearch01,elasticsearch02"
volumes:
- ./volumes/elasticsearch01/data:/usr/share/elasticsearch/data
elasticsearch02:
image: dockerregistry.homeoffice.anfcorp.com/vendor/elasticsearch/elasticsearch:7.8.0
ports:
- "9201:9200"
environment:
cluster.name: "docker-cluster"
node.name: "elasticsearch02"
network.host: 0.0.0.0
indices.query.bool.max_clause_count: 100000
discovery.seed_hosts: "elasticsearch01"
transport.tcp.port: 9300
cluster.initial_master_nodes: "elasticsearch01,elasticsearch02"
volumes:
- ./volumes/elasticsearch02/data:/usr/share/elasticsearch/data
elasticsearch03:
image: dockerregistry.homeoffice.anfcorp.com/vendor/elasticsearch/elasticsearch:7.8.0
ports:
- "9202:9200"
environment:
cluster.name: "docker-cluster"
node.name: "elasticsearch03"
network.host: 0.0.0.0
indices.query.bool.max_clause_count: 100000
discovery.seed_hosts: "elasticsearch01"
transport.tcp.port: 9300
cluster.initial_master_nodes: "elasticsearch01,elasticsearch02"
volumes:
- ./volumes/elasticsearch03/data:/usr/share/elasticsearch/data
```