Fluentd + Elasticsearch = 连接被拒绝

Fluentd + Elasticsearch = Connection refused

我正在尝试将 fluentd 与 elasticsearch 连接,但在启动 td-agent 服务时出现此错误。

td-agent.log:

无法与 Elasticsearch 通信,重置连接并重试。连接被拒绝 - connect(2) for 127.0.0.1:9092 (Errno::ECONNREFUSED)

td-agent.conf

<match docker.*>
  @type elasticsearch
  host localhost
  port 9092
  logstash_format true
</match>

我的 elasticsearch 是 运行 因为我可以查看 http://localhost:9200/ 以及 fluentd 插件

plugin 2020-05-21 12:57:55 -0300 [info]: gem 'fluent-plugin-elasticsearch' version '4.0.8'

如果您可以从 localhost:9200 访问 elasticsearch,那么 .conf 将如下所示:

<match docker.*>
  @type elasticsearch
  host localhost
  port 9200
  logstash_format true
</match>