【问题标题】:Using Fluentd to transfer data to DocumentDB使用 Fluentd 将数据传输到 DocumentDB
【发布时间】:2021-11-09 08:09:57
【问题描述】:

我可以使用 Fluentd 将数据传输到基于 AWS EC2 构建的 mongoDB,但我无法将数据传输到 DocumentDB,它是与 mongoDB 兼容的托管服务。

以下是将/var/log/test/bulk/中保存的json文件传输到mongoDB的td-agent.conf

<source>
  @type tail
  path /var/log/test/bulk/*
  tag bulk.*
  format json
  time_key time
  time_format '%F %T.%N %z %Z'
  pos_file /var/log/test/run/log-json.pos
  read_from_head true
  refresh_interval 5s
</source>

<match bulk.**>
  @type record_reformer
  tag test.${tag_parts[-3]}.${tag_parts[-2]}
</match>

<match test.**>
  @type copy
  <store>
    @type forest
    subtype mongo_replset
    <template>
      host hostname1:27017,hostname2:27017,hostname3:27017
      replica_set rs0 
      database ${tag_parts[-2]}
      collection ${tag_parts[-1]}
      user ********
      password ********
      replace_dot_in_key_with __dot__
      <buffer>
        @type file
        path /var/log/test/buffer-mongo/${tag_parts[-2..-1]}
        chunk_limit_size 8m
        queued_chunks_limit_size 64
        flush_interval 1s
      </buffer>
    </template>
  </store>
</match>

在转DocumentDB的时候,我把上面conf文件里的host改成集群endpoint,但是出现如下错误。

 [warn]: #0 failed to flush the buffer. retry_time=0 next_retry_seconds=2021-09-14 10:26:56 +0900 chunk="5cbea78155b58ec0810e9fde94aa2355" error_class=Mongo::Error::NoServerAvailable error="No server is available matching preference: #<Mongo::ServerSelector::Primary:0x70233136498300 tag_sets=[] max_staleness=nil> using server_selection_timeout=30 and local_threshold=0.015"

由于在 DocumentDB 中启用了 TLS,我想知道是否需要 specify rds-combined-ca-bundle.pem 来启用 TLS。我想是的,但我不知道该怎么做。 (当我在 Python 中使用the link 测试写入 DocumentDB 时,在禁用 TLS 时出现上述错误。)

您能告诉我如何在启用 TLS 的情况下将数据写入 DocumentDB 吗?

【问题讨论】:

    标签: mongodb amazon-web-services fluentd


    【解决方案1】:

    Amazon DocumentDB 集群部署在 Amazon Virtual Private Cloud (Amazon VPC) 中。它们可以由部署在同一 Amazon VPC 中的 Amazon EC2 实例或其他 AWS 服务直接访问。客户端应用程序是否与 DocumentDB 集群在同一 VPC 和安全组中运行?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-17
      • 1970-01-01
      • 1970-01-01
      • 2018-10-19
      • 2018-03-30
      • 2021-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多