markdown 自动重启Elasticsearch

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 自动重启Elasticsearch相关的知识,希望对你有一定的参考价值。

Restart on failure option is missing in the default service of elasticsearch.

So, We can add Restart=always option in the service.

### Steps to add - Restart=always

1. Edit elasticsearch service unit file using the 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 and refresh the unit file using command `sudo systemctl daemon-reload`

4. Can check the changes using command `sudo systemctl cat elasticsearch.service`

#### NOTE

We can use `Restart= always, on-abnormal, on-success, on-failure, etc` based on the requirement


以上是关于markdown 自动重启Elasticsearch的主要内容,如果未能解决你的问题,请参考以下文章

markdown 没有sudo重启nginx?

markdown 重启

markdown 重启后保存并恢复tmux会话

markdown 重启

markdown 批量重启小时内挂掉的码头工人

markdown 更改Ubuntu主机名而不重启