質問するログイン新規登録

質問編集履歴

2

誤字

2021/09/14 21:44

投稿

user360ls
user360ls

スコア14

title CHANGED
File without changes
body CHANGED
@@ -25,7 +25,7 @@
25
25
  @type forest
26
26
  subtype mongo_replset
27
27
  <template>
28
- host hostname1:27017,hostname2:27017,hostname3:27017
28
+ nodes hostname1:27017,hostname2:27017,hostname3:27017
29
29
  replica_set rs0
30
30
  database ${tag_parts[-2]}
31
31
  collection ${tag_parts[-1]}

1

質問内容を具体的にしました

2021/09/14 21:44

投稿

user360ls
user360ls

スコア14

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,56 @@
1
- 下記のサイト参考にEC2に構築したmongoDBにFluentd使ってjsonファイル収集しています。
1
+ Fluentd使ってAWSのEC2に構築したmongoDBにデータ転送することはできるのですが、mongoDB互換のマネージドサービスであるDocumentDBにデータ転送ることができません
2
2
 
3
+ 下記は/var/log/test/bulk/に保存したjsonファイルをmongoDBに転送する際のtd-agent.confです。
4
+ ```
5
+ <source>
6
+ @type tail
7
+ path /var/log/test/bulk/*
8
+ tag bulk.*
9
+ format json
10
+ time_key time
11
+ time_format '%F %T.%N %z %Z'
3
- https://jappy.hatenablog.com/entry/20131218/1387380285
12
+ pos_file /var/log/test/run/log-json.pos
13
+ read_from_head true
14
+ refresh_interval 5s
15
+ </source>
4
16
 
5
- 今後、EC2内のmongoDBをAWSのDocumentDBに置き換えようと考えているのですが、fluent-plugin-mongoとは別のプラグインが必要なのか、Fluentdのconfigファイルの書き換えで済むのか情報が見つからない状況です。
6
- Fluentdを使ったDocumentDBへの接続の事例などありましたら教えて頂きたく、よろしくお願い致します。
17
+ <match bulk.**>
18
+ @type record_reformer
19
+ tag test.${tag_parts[-3]}.${tag_parts[-2]}
20
+ </match>
21
+
22
+ <match test.**>
23
+ @type copy
24
+ <store>
25
+ @type forest
26
+ subtype mongo_replset
27
+ <template>
28
+ host hostname1:27017,hostname2:27017,hostname3:27017
29
+ replica_set rs0
30
+ database ${tag_parts[-2]}
31
+ collection ${tag_parts[-1]}
32
+ user ********
33
+ password ********
34
+ replace_dot_in_key_with __dot__
35
+ <buffer>
36
+ @type file
37
+ path /var/log/test/buffer-mongo/${tag_parts[-2..-1]}
38
+ chunk_limit_size 8m
39
+ queued_chunks_limit_size 64
40
+ flush_interval 1s
41
+ </buffer>
42
+ </template>
43
+ </store>
44
+ </match>
45
+ ```
46
+
47
+ DocumentDBに転送する際は、上記のconfファイルのhostをクラスターのエンドポイントに変更しましたが、下記のエラーが発生しました。
48
+
49
+ ```
50
+ 2021-09-14 10:26:55 +0900 [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"
51
+ ```
52
+
53
+ DocumentDBはTLSが有効になっているため、[rds-combined-ca-bundle.pem](https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem)を指定しTLSを有効にする必要があるとのかな?と思ってるのですが、その方法がわかりません。
54
+ ([リンク先](https://docs.aws.amazon.com/ja_jp/documentdb/latest/developerguide/connect_programmatically.html)を参考にPythonでDocumentDBへの書き込みテストを行ったときに、TLSを無効にすると上記のエラーが発生しました。)
55
+
56
+ TLSを有効にしてDocumentDBにデータを書き込む方法を教えて頂けますでしょうか?