|
| 1 | +[[stopping-elasticsearch]] |
| 2 | +=== Stopping Elasticsearch |
| 3 | + |
| 4 | +An orderly shutdown of Elasticsearch ensures that Elasticsearch has a chance to cleanup and close |
| 5 | +outstanding resources. For example, a node that is shutdown in an orderly fashion will remove itself |
| 6 | +from the cluster, sync translogs to disk, and perform other related cleanup activities. You can help |
| 7 | +ensure an orderly shutdown by properly stopping Elasticsearch. |
| 8 | + |
| 9 | +If you're running Elasticsearch as a service, you can stop Elasticsearch via the service management |
| 10 | +functionality provided by your installation. |
| 11 | + |
| 12 | +If you're running Elasticsearch directly, you can stop Elasticsearch by sending control-C if you're |
| 13 | +running Elasticsearch in the console, or by sending `SIGTERM` to the Elasticsearch process on a |
| 14 | +POSIX system. You can obtain the PID to send the signal to via various tools (e.g., `ps` or `jps`) |
| 15 | +or by specifying a location to write a PID file to on startup (`-p <path>`). |
| 16 | + |
| 17 | +[source,sh] |
| 18 | +-------------------------------------------------- |
| 19 | +$ ./bin/elasticsearch -p /tmp/elasticsearch-pid -d |
| 20 | +$ cat /tmp/elasticsearch-pid && echo |
| 21 | +7801 |
| 22 | +$ kill -SIGTERM 7801 |
| 23 | +-------------------------------------------------- |
| 24 | + |
| 25 | +[[fatal-errors] |
| 26 | +[float] |
| 27 | +=== Stopping on Fatal Errors |
| 28 | + |
| 29 | +During the life of the Elasticsearch virtual machine, certain fatal errors could arise that put the |
| 30 | +virtual machine in a questionable state. Such fatal errors include out of memory errors, internal |
| 31 | +errors in virtual machine, and serious I/O errors. |
| 32 | + |
| 33 | +When Elasticsearch detects that the virtual machine has encountered such a fatal error Elasticsearch |
| 34 | +will attempt to log the error and then will halt the virtual machine. When Elasticsearch initiates |
| 35 | +such a shutdown, it does not go through an orderly shutdown as described above. The Elasticsearch |
| 36 | +process will also return with a special status code indicating the nature of the error. |
| 37 | + |
| 38 | +[horizontal] |
| 39 | +JVM internal error:: 128 |
| 40 | +Out of memory error:: 127 |
| 41 | +Stack overflow error:: 126 |
| 42 | +Unknown virtual machine error:: 125 |
| 43 | +Serious I/O error:: 124 |
| 44 | +Unknown fatal error:: 1 |
0 commit comments