Hi,
I am trying to spin up a three node Elasticsearch cluster with a docker-compose file. While spinning up the cluster only one Elasticsearch container is coming up whereas other two containers on different nodes are failing due to AccessDenied Exception.
I have given the same local directory permissions on all the three nodes.
Logs:
es02 | {"type": "server", "timestamp": "2020-12-14T16:41:01,887Z", "level": "ERROR", "component": "o.e.b.ElasticsearchUncaughtExceptionHandler", "cluster.name": "es-docker-cluster", "node.name": "xxxxxxxxxx", "message": "uncaught exception in thread [main]", es02 | "stacktrace": ["org.elasticsearch.bootstrap.StartupException: ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/usr/share/elasticsearch/data/nodes];", es02 | "at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:174) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) ~[elasticsearch-cli-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "Caused by: org.elasticsearch.ElasticsearchException: failed to bind service", es02 | "at org.elasticsearch.node.Node.<init>(Node.java:729) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.node.Node.<init>(Node.java:289) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:227) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:227) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "... 6 more", es02 | "Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes", es02 | "at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]", es02 | "at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) ~[?:?]", es02 | "at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]", es02 | "at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:388) ~[?:?]", es02 | "at java.nio.file.Files.createDirectory(Files.java:694) ~[?:?]", es02 | "at java.nio.file.Files.createAndCheckIsDirectory(Files.java:801) ~[?:?]", es02 | "at java.nio.file.Files.createDirectories(Files.java:787) ~[?:?]", es02 | "at org.elasticsearch.env.NodeEnvironment.lambda$new$0(NodeEnvironment.java:275) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:212) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:272) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.node.Node.<init>(Node.java:362) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.node.Node.<init>(Node.java:289) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:227) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:227) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.10.0.jar:7.10.0]", es02 | "... 6 more"] } es02 | uncaught exception in thread [main] es02 | ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/usr/share/elasticsearch/data/nodes]; es02 | Likely root cause: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes es02 | at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) es02 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) es02 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) es02 | at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:388) es02 | at java.base/java.nio.file.Files.createDirectory(Files.java:694) es02 | at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:801) es02 | at java.base/java.nio.file.Files.createDirectories(Files.java:787) es02 | at org.elasticsearch.env.NodeEnvironment.lambda$new$0(NodeEnvironment.java:275) es02 | at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:212) es02 | at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:272) es02 | at org.elasticsearch.node.Node.<init>(Node.java:362) es02 | at org.elasticsearch.node.Node.<init>(Node.java:289) es02 | at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:227) es02 | at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:227) es02 | at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) es02 | at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) es02 | at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) es02 | at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) es02 | at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) es02 | at org.elasticsearch.cli.Command.main(Command.java:90) es02 | at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) es02 | at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) es02 | For complete error details, refer to the log at /usr/share/elasticsearch/logs/es-docker-cluster.log es02 exited with code 1
Listing permissions of my local mount directories.
On Node 1:
Running my Compose from this node 1.
drwxrwxrwx 2 elasticsearch elasticsearch 6 Dec 2 15:25 es_data01
Container is coming up without any issues
On Node 2:
drwxrwxrwx 2 elasticsearch elasticsearch 6 Dec 2 15:25 es_data02
Container is not coming up with Accessdenied exception
On Node 3:
drwxrwxrwx 2 elasticsearch elasticsearch 6 Dec 2 15:25 es_data03
Container is not coming up with Accessdenied exception
Attaching my composePreformatted text file.
> version: '2.2'
> services:
> es01:
> image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
> container_name: es01
> environment:
> - node.name=node01
> - discovery.seed_hosts=node02, node03
> - cluster.initial_master_nodes=node01,node02, node03
> - cluster.name=es-docker-cluster
> - node.master=true
> - node.data=true
> - bootstrap.memory_lock=true
> - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
> ulimits:
> memlock:
> soft: -1
> hard: -1
> volumes:
> #- data01:/usr/share/elasticsearch/data
> - /es_data01:/usr/share/elasticsearch/data
> ports:
> - 9200:9200
> networks:
> - elastic
> es02:
> image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
> container_name: es02
> environment:
> - node.name=node02
> - discovery.seed_hosts=node01, node03
> - cluster.initial_master_nodes=node01,node02, node03
> - cluster.name=es-docker-cluster
> - node.master=true
> - node.data=true
> - bootstrap.memory_lock=true
> - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
> ulimits:
> memlock:
> soft: -1
> hard: -1
> volumes:
> #- data02:/usr/share/elasticsearch/data
> - /es_data02:/usr/share/elasticsearch/data
> networks:
> - elastic
> es03:
> image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
> container_name: es03
> environment:
> - node.name=node03
> - discovery.seed_hosts=node01,node02
> - cluster.initial_master_nodes=node01,node02, node03
> - cluster.name=es-docker-cluster
> - node.master=true
> - node.data=true
> - bootstrap.memory_lock=true
> - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
> ulimits:
> memlock:
> soft: -1
> hard: -1
> volumes:
> #- data03:/usr/share/elasticsearch/data
> - /es_data03:/usr/share/elasticsearch/data
> networks:
> - elastic
>
> volumes:
> es_data01:
> driver: local
> es_data02:
> driver: local
> es_data03:
> driver: local
>
> networks:
> elastic:
> driver: bridge