0
Not a bug

elasticsearch docker container fails immediately (docker documentation)

Rudhra 7 months ago updated by Vlad R 6 months ago 5

I followed the documentation and succesfully have filerun running: https://docs.filerun.com/docker-tika

Unfortunatly, the elasticsearch container does not start. Portainer shows an exception error.

As my docker-compose looks exactly like the documentation, I am not sure how to debug this, as I didn't do any customisation yet.
How can I get this container to start successfully?

[2020-05-13T10:50:52,517][INFO ][o.e.n.Node ] [] initializing ...

[2020-05-13T10:50:52,530][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]

org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment

at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.4.jar:6.2.4]

at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.2.4.jar:6.2.4]

Caused by: java.lang.IllegalStateException: Failed to create node environment

at org.elasticsearch.node.Node.<init>(Node.java:267) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.node.Node.<init>(Node.java:246) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.4.jar:6.2.4]

... 6 more

Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes

at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:?]

at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:?]

at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:?]

at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:?]

at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_161]

at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_161]

at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_161]

at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:204) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.node.Node.<init>(Node.java:264) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.node.Node.<init>(Node.java:246) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.4.jar:6.2.4]

at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.4.jar:6.2.4]

... 6 more


Answer

Answer

2 things were necessary:

I had to change ownership of

sudo chown -R $USER:$USER ${USERDIR}/docker/filerun/esearch
sudo chmod 777 ${USERDIR}/docker/filerun/esearch

note I tried 644, 666. It only worked with 777. 


Yet the container would still fail.

If the host is running Debian or Ubuntu, according to the ElasticSearch documentation it says here you need to run the following command. The second command keeps it persistent after reboot of the host machine.

sudo sysctl -w vm.max_map_count=262144
sudo sh -c "echo 'vm.max_map_count=262144' >> /etc/sysctl.conf"

This solved the problem.
Perhaps this can be added to the documentation.

Under review

How much free RAM is there on the server?

32GB in total, never seen more than 9GB in use.

Intel Core i3-9100, Fujitsu D3644-B motherboard with Intel C246 chipset. Running on Ubuntu Budgie 19.10.

it is 2x 16GB non-registered ECC DDR4-2666Mhz.

Not a bug

Try this: https://github.com/elastic/elasticsearch-docker/issues/21#issuecomment-263133387

If it doesn't help, I suggest you seek assistance with this from the ElasticSearch developers/community.

Answer

2 things were necessary:

I had to change ownership of

sudo chown -R $USER:$USER ${USERDIR}/docker/filerun/esearch
sudo chmod 777 ${USERDIR}/docker/filerun/esearch

note I tried 644, 666. It only worked with 777. 


Yet the container would still fail.

If the host is running Debian or Ubuntu, according to the ElasticSearch documentation it says here you need to run the following command. The second command keeps it persistent after reboot of the host machine.

sudo sysctl -w vm.max_map_count=262144
sudo sh -c "echo 'vm.max_map_count=262144' >> /etc/sysctl.conf"

This solved the problem.
Perhaps this can be added to the documentation.