Hi, I'm very new to Docker as well as Elasticsearch. I was following a tutorial and used this docker compose file to install Elasticsearch:
version: "4.6"
services:
es01:
image: "docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2"
ports:
- "9200:9200"
- "9300:9300"
environment:
node.name: es01
discovery.seed_hosts: es01,es02,es03
cluster.initial_master_nodes: es01,es02,es03
cluster.name: mycluster
bootstrap.memory_lock: "true"
ES_JAVA_OPTS: -Xms256m -Xmx256m
volumes:
- "es-data-es01:/usr/share/elasticsearch/data"
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:9200"]
interval: 10s
timeout: 10s
retries: 120
es02:
image: "docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2"
ports:
- "9201:9200"
- "9301:9300"
environment:
node.name: es02
discovery.seed_hosts: es01,es02,es03
cluster.initial_master_nodes: es01,es02,es03
cluster.name: mycluster
bootstrap.memory_lock: "true"
ES_JAVA_OPTS: -Xms256m -Xmx256m
volumes:
- "es-data-es02:/usr/share/elasticsearch/data"
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:9200"]
interval: 10s
timeout: 10s
retries: 120
es03:
image: "docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2"
ports:
- "9202:9200"
- "9303:9300"
environment:
node.name: es03
discovery.seed_hosts: es01,es02,es03
cluster.initial_master_nodes: es01,es02,es03
cluster.name: mycluster
bootstrap.memory_lock: "true"
ES_JAVA_OPTS: -Xms256m -Xmx256m
volumes:
- "es-data-es03:/usr/share/elasticsearch/data"
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:9200"]
interval: 10s
timeout: 10s
retries: 120
kibana:
image: docker.elastic.co/kibana/kibana-oss:7.10.2
depends_on:
es01:
condition: service_healthy
es02:
condition: service_healthy
es03:
condition: service_healthy
ports:
- "5601:5601"
environment:
- 'ELASTICSEARCH_HOSTS=["http://es01:9200","http://es02:9200","http://es03:9200"]'
volumes:
es-data-es01:
es-data-es02:
es-data-es03:
I get a FileSystemException
error when I run docker compose:
api-es03-1 | "stacktrace": ["org.elasticsearch.bootstrap.StartupException: ElasticsearchException[failed to bind service]; nested: FileSystemException[/usr/share/elasticsearch/data/nodes/0: Not a directory];",
api-es03-1 | "at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:174) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) ~[elasticsearch-cli-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "Caused by: org.elasticsearch.ElasticsearchException: failed to bind service",
api-es03-1 | "at org.elasticsearch.node.Node.<init>(Node.java:729) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.node.Node.<init>(Node.java:289) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:227) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:227) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.10.2.jar:7.10.2]",
api-es03-1 | "... 6 more",