【问题标题】:Fluentd with elasticsearch unreachable_exception使用弹性搜索 unreachable_exception 流利
【发布时间】:2020-05-28 22:01:59
【问题描述】:

我正在设置 elasticsearch 并在 docker 中流利,我得到了host_unreachable_exceptions。以下是我的完整异常日志:

2020-02-13 08:45:05 +0000 [error]: #0 unexpected error error_class=NameError error="uninitialized constant Faraday::Error::ConnectionFailed"
  2020-02-13 08:45:05 +0000 [error]: #0 /usr/lib/ruby/gems/2.5.0/gems/elasticsearch-transport-7.4.0/lib/elasticsearch/transport/transport/http/faraday.rb:51:in `host_unreachable_exceptions'
  2020-02-13 08:45:05 +0000 [error]: #0 /usr/lib/ruby/gems/2.5.0/gems/fluent-plugin-elasticsearch-4.0.3/lib/fluent/plugin/elasticsearch_index_template.rb:36:in `rescue in retry_operate'
  2020-02-13 08:45:05 +0000 [error]: #0 /usr/lib/ruby/gems/2.5.0/gems/fluent-plugin-elasticsearch-4.0.3/lib/fluent/plugin/elasticsearch_index_template.rb:34:in `retry_operate'
  2020-02-13 08:45:05 +0000 [error]: #0 /usr/lib/ruby/gems/2.5.0/gems/fluent-plugin-elasticsearch-4.0.3/lib/fluent/plugin/out_elasticsearch.rb:282:in `configure'

我的 docker-compose 文件是:

version: '3'
services:

    elasticsearch:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0
      container_name: Eagle_Core_local_elasticsearch
      environment:
        - xpack.security.enabled=false
        - discovery.type=single-node
      ulimits:
        memlock:
          soft: -1
          hard: -1
        nofile:
          soft: 65536
          hard: 65536
      cap_add:
        - IPC_LOCK
      volumes:
        - ./../../../data/elasticsearch-data:/usr/share/elasticsearch/data
      networks:
        - eaglenet
      ports:
        - 9200:9200
        - 9300:9300

    fluentd:
      container_name: Eagle_Core_FluentLogger
      build:
        context: ./docker-conf/fluentd
      environment:
        - FLUENT_UID=1000
      networks:
        - eaglenet
      ports:
        - "24231:24231"
      volumes:
        - ./../../../log/fluentd:/fluentd/log
        - ./docker-conf/fluentd/fluent.conf:/fluentd/etc/fluent.conf
      logging:
        driver: "json-file"
        options:
          max-size: "200k"
          max-file: "3"
      env_file:
        - ./local.config.env

这是我的fluent.conf

<match flight.error.log>
  @type elasticsearch
  host elasticsearch
  port 9200
  utc_index false
  target_index_key @target_index
  logstash_prefix ${tag}
  logstash_dateformat %Y%m%d
  type_name error_log
  <buffer>
    flush_interval 2s
    chunk_limit_size 64m
    flush_thread_count 4
    @type file
    path /fluentd/log/flight
  </buffer>
</match>

注意:我可以从 fluentd 容器 ping elasticsearch:9200

【问题讨论】:

    标签: docker elasticsearch docker-compose fluentd


    【解决方案1】:

    我也有同样的问题。请看这个https://github.com/uken/fluent-plugin-elasticsearch/issues/699,lucasteles22 说需要修改脚本 elasticsearch-transport-7.4.0/lib/elasticsearch/transport/transport/http/fa raday.rb:51。我试过了,效果很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-21
      • 2021-03-18
      • 1970-01-01
      相关资源
      最近更新 更多