MongoDB 接続の使用
MongoDB の接続を作成すると、ETL ジョブで接続を使用することができます。AWS Glue Data Catalog にテーブルを作成し、テーブルの connection
属性に MongoDB 接続を指定します。
AWS Glue では、接続 url
と MongoDB 接続の認証情報が保存されます。さらに、ジョブスクリプトで次のオプションを指定できます。
-
"database"
: (必須) 読み込み元の MongoDB データベース。 -
"collection"
: (必須) 読み込み元の MongoDB コレクション。 -
"ssl"
: (オプション)true
の場合、AWS Glue は SSL 接続を開始します。デフォルト値はfalse
です。 -
"ssl.domain_match"
: (オプション)true
とssl
がtrue
の場合、AWS Glueは ドメイン一致チェックを実行します。デフォルト値はtrue
です。 -
"batchSize"
: (オプション): 内部バッチのカーソル内で使用される、バッチごとに返されるドキュメントの数。 -
"partitioner"
: (オプション): MongoDB から入力データを読み取るためのパーティショナーのクラス名。コネクタには、次のパーティショナーがあります。-
MongoDefaultPartitioner
(デフォルト) -
MongoSamplePartitioner
(MongoDB 3.2 以降が必要です) -
MongoShardedPartitioner
-
MongoSplitVectorPartitioner
-
MongoPaginateByCountPartitioner
-
MongoPaginateBySizePartitioner
-
-
"partitionerOptions"
(オプション): 指定されたパーティショナーのオプション。各パーティショナーでは、次のオプションがサポートされています。-
MongoSamplePartitioner
–partitionKey
、partitionSizeMB
、およびsamplesPerPartition
-
MongoShardedPartitioner
–shardkey
-
MongoSplitVectorPartitioner
–partitionKey
およびpartitionSizeMB
-
MongoPaginateByCountPartitioner
–partitionKey
およびnumberOfPartitions
-
MongoPaginateBySizePartitioner
–partitionKey
およびpartitionSizeMB
-
これらのパラメータの詳細については、「https://docs.mongodb.com/spark-connector/master/configuration/#partitioner-conf