Elasticsearch container exists with error once after builds Laradock

434 Views Asked by At

There is a Laravel project running on my local server in Laradock in Windows 11. It is running PHP 7.4. It is working fine. I upgraded Laradock and the project to their latest versions and changed the PHP version to 8.2. And built Laradock again using the following command:

docker-compose up -d --build nginx postgres php-worker redis elasticsearch kibana

After completing the build, elasticsearch server exists with the following error:

2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.290Z", "log.level": "INFO", "message":"loaded module [x-pack-eql]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.290Z", "log.level": "INFO", "message":"loaded module [x-pack-fleet]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.291Z", "log.level": "INFO", "message":"loaded module [x-pack-graph]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.292Z", "log.level": "INFO", "message":"loaded module [x-pack-identity-provider]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.292Z", "log.level": "INFO", "message":"loaded module [x-pack-ilm]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.293Z", "log.level": "INFO", "message":"loaded module [x-pack-logstash]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.294Z", "log.level": "INFO", "message":"loaded module [x-pack-ml]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.297Z", "log.level": "INFO", "message":"loaded module [x-pack-monitoring]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.297Z", "log.level": "INFO", "message":"loaded module [x-pack-ql]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.297Z", "log.level": "INFO", "message":"loaded module [x-pack-rollup]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.298Z", "log.level": "INFO", "message":"loaded module [x-pack-security]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.298Z", "log.level": "INFO", "message":"loaded module [x-pack-shutdown]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.298Z", "log.level": "INFO", "message":"loaded module [x-pack-sql]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.298Z", "log.level": "INFO", "message":"loaded module [x-pack-stack]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.299Z", "log.level": "INFO", "message":"loaded module [x-pack-text-structure]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.299Z", "log.level": "INFO", "message":"loaded module [x-pack-voting-only-node]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.299Z", "log.level": "INFO", "message":"loaded module [x-pack-watcher]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:37 {"@timestamp":"2023-08-07T12:43:37.300Z", "log.level": "INFO", "message":"no plugins loaded", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.plugins.PluginsService","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:39 {"@timestamp":"2023-08-07T12:43:39.598Z", "log.level": "INFO", "message":"using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/sdc)]], net usable_space [185.9gb], net total_space [250.9gb], types [ext4]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.env.NodeEnvironment","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:39 {"@timestamp":"2023-08-07T12:43:39.598Z", "log.level": "INFO", "message":"heap size [512mb], compressed ordinary object pointers [true]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.env.NodeEnvironment","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:39 {"@timestamp":"2023-08-07T12:43:39.601Z", "log.level": "INFO", "message":"upgrading legacy data folders: [/usr/share/elasticsearch/data]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.env.NodeEnvironment","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster"}
2023-08-07 18:13:39 {"@timestamp":"2023-08-07T12:43:39.653Z", "log.level":"ERROR", "message":"fatal exception while booting Elasticsearch", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.bootstrap.Elasticsearch","elasticsearch.node.name":"laradock-node","elasticsearch.cluster.name":"laradock-cluster","error.type":"org.elasticsearch.bootstrap.StartupException","error.message":"java.lang.IllegalStateException: cannot upgrade a node from version [7.9.1] directly to version [8.3.1], upgrade to version [7.17.0] first.","error.stack_trace":"java.lang.IllegalStateException: cannot upgrade a node from version [7.9.1] directly to version [8.3.1], upgrade to version [7.17.0] first.\n\tat [email protected]/org.elasticsearch.env.NodeMetadata.verifyUpgradeToCurrentVersion(NodeMetadata.java:122)\n\tat [email protected]/org.elasticsearch.env.NodeEnvironment.checkForIndexCompatibility(NodeEnvironment.java:517)\n\tat [email protected]/org.elasticsearch.env.NodeEnvironment.upgradeLegacyNodeFolders(NodeEnvironment.java:408)\n\tat [email protected]/org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:301)\n\tat [email protected]/org.elasticsearch.node.Node.<init>(Node.java:438)\n\tat [email protected]/org.elasticsearch.node.Node.<init>(Node.java:300)\n\tat [email protected]/org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:230)\n\tat [email protected]/org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:230)\n\tat [email protected]/org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333)\n\tat [email protected]/org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:224)\n\tat [email protected]/org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:67)\nFor complete error details, refer to the log at /usr/share/elasticsearch/logs/laradock-cluster.log\n"}
2023-08-07 18:13:39 java.lang.IllegalStateException: cannot upgrade a node from version [7.9.1] directly to version [8.3.1], upgrade to version [7.17.0] first.
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.env.NodeMetadata.verifyUpgradeToCurrentVersion(NodeMetadata.java:122)
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.env.NodeEnvironment.checkForIndexCompatibility(NodeEnvironment.java:517)
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.env.NodeEnvironment.upgradeLegacyNodeFolders(NodeEnvironment.java:408)
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:301)
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.node.Node.<init>(Node.java:438)
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.node.Node.<init>(Node.java:300)
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:230)
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:230)
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333)
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:224)
2023-08-07 18:13:39     at [email protected]/org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:67)
2023-08-07 18:13:39 For complete error details, refer to the log at /usr/share/elasticsearch/logs/laradock-cluster.log
2023-08-07 18:13:39 ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/laradock-cluster.log
2023-08-07 18:13:39 
2023-08-07 18:13:39 ERROR: Elasticsearch exited unexpectedly

Is there any clue to resolving this issue and running the elastic server properly in Laradock?

1

There are 1 best solutions below

0
cha On

I have updated Laradock again to its latest version. I saw there are a few changes in docker-compose.yml. Some changes are related to NPM and Java. After updating to the latest, the above issue was resolved. But there occurred a memory issue:

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least 262144

To resolve this, I increased memory by running the following commands:

wsl -d docker-desktop
sysctl -w vm.max_map_count=262144

So, it's working fine. But I had to set the memory every time I restarted the computer. There is a way to handle that too. We need to add**.wslconfig** file with following configuration to the user's home directory in windows.

You can create a config file (.wslconfig) at:

C:\Users\[your user]\.wslconfig

Content of the file

[wsl2]
kernelCommandLine = "sysctl.vm.max_map_count=262144"

This is how I resolved my issue in my local environment. I think it will be helpful for you all.