首页 > 解决方案 > 一旦在 Linux 服务器上崩溃,如何自动重启 elasticsearch 搜索?

问题描述

一旦我的弹性搜索在 linux 服务器上崩溃。它给了我以下错误:

Elasticsearch\Common\Exceptions\NoNodesAvailableException:/var/www/laravel/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php:51 No alive nodes found in your cluster 

太解决这个我需要重置完整的服务器。

我想要解决方案,因为我的弹性搜索服务会在崩溃时自动重启。

我的服务器配置:

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

如何在崩溃时自动重启我的弹性搜索的服务器上设置一些东西。?

标签: linuxelasticsearchserviceservercentos

解决方案


崩溃或宕机后自动重启 elasticsearch 服务的步骤:

1)使用以下命令编辑elasticsearch服务单元文件

sudo systemctl edit elasticsearch.service 

该命令将创建一个文件

/etc/systemd/system/elasticsearch.service.d/override.conf

2) 现在,在单元文件中添加以下行。

[Service]
Restart=always

3) 保存文件。

ctrl+x  > Y > Enter

4) 使用命令刷新单元文件

sudo systemctl daemon-reload

5)可以使用命令检查更改

sudo systemctl cat elasticsearch.service

推荐阅读