Even though we expect our cluster (or node) to run flawlessly for a lifetime, we may end up needing to restart it or shut it down properly (for example, for maintenance). There are three ways in which we can shut down ElasticSearch:
–f
option), just press Ctrl + CWe will focus on the last method now. It allows us to shut down the whole cluster by executing the following command:
curl -XPOST http://localhost:9200/_cluster/nodes/_shutdown
To shut down just a single node, execute the following command:
curl –XPOST http://localhost:9200/_cluster/nodes/BlrmMvBdSKiCeYGsiHijdg/_shutdown
In the previous command line, BlrmMvBdSKiCeYGsiHijdg
is the identifier for a given node. The former may be read from ElasticSearch logs or from another API call:
curl -XGET http://localhost:9200/_cluster/nodes/