Elasticsearch 连接被拒绝

Elasticsearch 连接被拒绝

我刚刚在 Debian 9 上安装了 ElasticSearch 7.1.1,使用 apt-get 存储库 VPS 4GB 内存.. 1vcpu

service elasticsearch status

 elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-06-04 16:53:25 CEST; 4min 53s ago
     Docs: http://www.elastic.co
  Process: 3161 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=78)
 Main PID: 3161 (code=exited, status=78)

Jun 04 16:53:11 MONITOR-BACKUP systemd[1]: Started Elasticsearch.
Jun 04 16:53:11 MONITOR-BACKUP elasticsearch[3161]: OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Jun 04 16:53:25 MONITOR-BACKUP systemd[1]: elasticsearch.service: Main process exited, code=exited, status=78/n/a
Jun 04 16:53:25 MONITOR-BACKUP systemd[1]: elasticsearch.service: Unit entered failed state.
Jun 04 16:53:25 MONITOR-BACKUP systemd[1]: elasticsearch.service: Failed with result 'exit-code'.

测试卷曲

curl -X GET http://159.69.195.123:9200/
curl: (7) Failed to connect to 159.69.195.123 port 9200: Connection refused

环境变量

$PATH
-bash: /usr/share/elasticsearch/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: No such file or directory

$JAVA_HOME
-bash: /usr/share/elasticsearch/jdk: Is a directory

答案1

在我的例子中,status=78,通过保持 node.name 和 cluster.initial_master_nodes 具有适当的名称,这个问题已经解决了。

 elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-08-07 19:55:30 EEST; 3s ago
     Docs: http://www.elastic.co
  Process: 2331 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=78)
 Main PID: 2331 (code=exited, status=78)

我读到,由于 Elasticsearch 7.x 中引入了集群协调的变化(https://www.elastic.co/blog/a-new-era-for-cluster-coordination-in-elasticsearch),因为日志显示我们被迫在生产中配置至少一个上述参数。

在这种情况下,可以通过将其添加到 elasticsearch.yml 中轻松解决:

node.name: node-1(或首选名称)

cluster.initial_master_nodes: node-1(或首选名称)

Elasticsearch 7.0 重大变更文档中也提到了这一点(https://www.elastic.co/guide/en/elasticsearch/reference/7.0/breaking-changes-7.0.html#_discovery_configuration_is_required_in_production)。

来源:https://groups.google.com/forum/#!topic/wazuh/MTNx6RcqRcQ

相关内容