Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop/shut down an elasticsearch node?

I want to restart an elasticsearch node with a new configuration. What is the best way to gracefully shut down an node?

Is killing the process the best way of shutting the server down, or is there some magic URL I can use to shut the node down?

like image 667
Michael_Scharf Avatar asked Jun 19 '13 12:06

Michael_Scharf


People also ask

How do I stop and start elasticsearch?

/usr/local/share/elasticsearch/bin/service/elasticsearch Usage: /usr/local/share/elasticsearch/bin/service/elasticsearch [ console | start | stop | restart | condrestart | status | install | remove | dump ] Commands: console Launch in the current console. start Start in the background as a daemon process.

What happens when a elasticsearch node goes down?

While reading about Elasticsearch I understood that Nodes have Shards. And we can make configuration for Primary and Replica Shards. If one of node goes down it retrieve data from replica shards which is in another node.


1 Answers

Updated answer.

_shutdown API has been removed in elasticsearch 2.x.

Some options:

  • In your terminal (dev mode basically), just type "Ctrl-C"

  • If you started it as a daemon (-d) find the PID and kill the process: SIGTERM will shut Elasticsearch down cleanly (kill -15 PID)

  • If running as a service, run something like service elasticsearch stop:

    • Linux
    • Windows

Previous answer. It's now deprecated from 1.6.

Yeah. See admin cluster nodes shutdown documentation

Basically:

# Shutdown local node $ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown'  # Shutdown all nodes in the cluster $ curl -XPOST 'http://localhost:9200/_shutdown' 
like image 94
dadoonet Avatar answered Oct 04 '22 00:10

dadoonet