Adnan used a cURL command to check if Elasticsearch is running or not.
But then the command returned the following error message.
curl: (7) Failed to connect to localhost port 9200: Connection refused
Let’s see the status of Elasticsearch by running
On line #9, you can see the warning “OpenJDK 64-Bit Server VM warning” and the line #10 shows that the Elasticsearch service main process has existed right away.
By default Elasticsearch 6.x JVM Heap size set to use minimum 1Gig of memory.
t2.micro has 1Gig of memory
Elasticsearch documentation recommends to set it to 50% of physical memory for kernel file system caches.
We know the problem, so let’s change the Elasticsearch JVM heap size.
/etc/elasticsearch/jvm.option using an editor of your choice (I promise that I will learn either vi or emacs… 😞)
When you read the comment in
jvm.options, you should set the minimum and maximum to the same value.
And you can see that the min and max JVM heap sizes are set to 1g on the bottom of above image.
Now update the min and max values to 512m, save the file and exit.
Restart Elasticsearch service,
and run the cURL command again.
Elasticsearch is now running on AWS EC2 t.micro instance.
The post Elasticsearch installation issue on a free tier (t2.micro) AWS EC2 instance appeared first on Slight Edge Coder.
Level up every day