Elasticsearch: "ERROR: elasticsearch exited unexpectedly" when trying to start elasticsearch
Mia Lopez
I am trying to start elasticsearch by running .bin/elasticsearch from the elasticsearch directory. However, I keep getting the error message ERROR: Elasticsearch exited unexpectedly. What could be the possible solution to this?
I installed Elasticsearch from archives on linux using the commands below.
wget
wget
shasum -a 512 -c elasticsearch-8.3.3-linux-x86_64.tar.gz.sha512
tar -xzf elasticsearch-8.3.3-linux-x86_64.tar.gz
cd elasticsearch-8.3.3/ 5 7 Answers
I had this problem with docker (ElasticSearch version 8.6.2, docker engine 23.0.1, and Ubuntu 22.04), following the instructions in ElasticSearch docs:
Using ElasticSearch in single node mode for testing.
I solved it by setting the maximum amount of memory docker can use to 4GB (-m 4GB):
docker run --name es01 -m 4GB -p 9200:9200 -it 0 You can solve this issue by increasing max_map_count to below or similar.
sudo sysctl -w vm.max_map_count=262144My pain was immediately gone after running that command.
0Adding -e "discovery.type=single-node" solved the issue for me on Docker:
docker run --name es-node01 --net elastic -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -t 2 I've had this issue when running Elasticsearch as a container in Docker. Allowing Docker to reserve more resources fixed it for me. I've played around and in my setup a minimum of 6 GB RAM was needed in order to have a stable single node cluster of Elasticsearch running.
1Set the custom memory allocation as you want.
example with 512m (if you want to increase with 2GB, like this ES_JAVA_OPTS=-Xms2g -Xmx2g)
Docker Compose
version: "3"
services: elasticsearch: container_name: elasticsearch_springboot environment: - "ES_JAVA_OPTS=-Xms512m -Xmx512m"Docker
docker run -d -p 9200:9200 -p 9300:9300 -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" --name elasticsearch The ES_JAVA_OPTS environment variable in your Elasticsearch Docker Compose file is used to set the Java Virtual Machine (JVM) options for Elasticsearch.
-Xms512m: Sets the initial memory allocation pool for the JVM to 512 megabytes (MB). This specifies the minimum amount of memory that Elasticsearch will allocate when it starts up.
-Xmx512m: Sets the maximum memory allocation pool for the JVM to 512 megabytes (MB). This specifies the maximum amount of memory that Elasticsearch can allocate.
Check.
Can you check
ls -ltd elasticsearch-8.3.3and give output here (about catalog permission).
To get around the following error:
ERROR: Elasticsearch exited unexpectedly, with exit code 78
On a Mac M1 arm64 architecture I had to run the following to start a Docker container running the latest elasticsearch image:
docker run -e "discovery.type=single-node" -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" -e "xpack.security.enabled=false" -d arm64v8/elasticsearch:8.10.3Thank you to Bret Fisher's Udemy Course on Docker Mastery for the solution here.