Once my elasticsearch crashed on linux server. it gives me following error:
Elasticsearch\Common\Exceptions\NoNodesAvailableException:/var/www/laravel/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php:51 No alive nodes found in your cluster
Too resolve this i need to reset full server.
I want solution as my elasticsearch service restart automatically in case on crash.
My server configuration :
Linux name 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
How can i set something on server which restart my elasticsearch automatically when crashed.?
1) Edit elasticsearch service unit file using the following command
sudo systemctl edit elasticsearch.service
This command will create a file
/etc/systemd/system/elasticsearch.service.d/override.conf
2) Now, add the following lines in the unit file.
[Service]
Restart=always
3) Save the file .
ctrl+x > Y > Enter
4) Refresh the unit file using command
sudo systemctl daemon-reload
5) Can check the changes using command
sudo systemctl cat elasticsearch.service