Elastic Search

How to Shutdown Elasticsearch Node

“An Elasticsearch node refers to a single instance of the Elasticsearch service. A collection of Elasticsearch search nodes make up a cluster. For example, if you have a single Elasticsearch node, it can be said that your Elasticsearch cluster is comprised of one node.

When working with an Elasticsearch node, it is good to ensure that you apply the proper procedure to start, restart, or shut down your node.

Performing the correct procedure ensures that your node has time to clean up and appropriately release system resources. For example, when shutting down a node, the node performs operations such as syncing translog, removing its entry from the cluster, etc.”

This article will show you the various methods you can apply to correctly shut down a node in an Elasticsearch cluster.

Let’s get started.

Method 1 – Shutting Down Elasticsearch Node as Service

In the latest Elasticsearch versions, you can manage your Elasticsearch node as a service. Therefore, using your system’s service manager is recommended if the node runs as a service.

On Linux, use systemd with the command:

$ sudo service elasticsearch stop

 
Or

$ sudo systemctl stop elasticsearch.service

 
On Windows, you can run the command:

.\bin\elasticsearch-service.bat stop

 
The service manager allows the node to shut down and perform the necessary cleanup operations gracefully.

On macOS, you can use Brew to manage the Elasticsearch service with the command:

$ brew services stop elasticsearch

 

Method 2 – Shutdown Elasticsearch Node Running Directly

If you are running the Elasticsearch node directly from the terminal session, you can shut it down by pressing CTRL + C command.

This will send a terminate signal to the process (POSIX), allowing the node to shut down gracefully.

In most cases, Elasticsearch will prompt you to confirm the termination signal.


If you know the PID of the Elasticsearch process, you can terminate the process using the kill or pkill command as shown:

kill -SIGTERM <pid>

 
On Windows, you can use the taskkill command as:

taskkill /T /PID <pid>

 
The command above will terminate the Elasticsearch process and all the associated children processes.

Conclusion

You learned various methods and techniques for shutting down an Elasticsearch node in this post.

Thanks for reading!!

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list