Skip to content

Instantly share code, notes, and snippets.

@markwalkom
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markwalkom/8972803 to your computer and use it in GitHub Desktop.
Save markwalkom/8972803 to your computer and use it in GitHub Desktop.
Elasticsearch - restarting and recovering
## For a node
This tells ES to not move shards around if a node/nodes drops out of the cluster;
`curl -XPUT eshost.example.com:9200/_cluster/settings -d '{"transient":{"cluster.routing.allocation.enable": none}}'`
`sudo service elasticsearch restart`
`curl -XPUT eshost.example.com:9200/_cluster/settings -d '{"transient":{"cluster.routing.allocation.enable": all}}'`
When you are done and the node/nodes are back, they will reinitialise their local shards and you're cluster should be back to green as fast as the local node can work.
## For a cluster
You can also speed a full cluster restart by settings the following config settings - *gateway.recover_after_nodes* and *gateway.expected_nodes* - preferably to the number of nodes in the cluster. This way when a cluster comes back it won't start recovery until it can see the numbers specified and when it does it will use local data as much as possible.
Finally you can set *index.recovery.concurrent_streams*, this requires a bit of testing to make sure you don't overwhelm your node, but if you can increase that from the default of 3 to something higher.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment