Firestore データベースにデータを書き込む
このページでは、移行プロセスの第 2 段階について説明します。この段階では、Dataflow パイプラインを設定し、Cloud Storage バケットから MongoDB 互換の宛先 Firestore データベースへの同時データ移動を開始します。このオペレーションは、Datastream ストリームと同時に実行されます。
Dataflow パイプラインを開始する
次のコマンドは、一意の名前を持つ新しい Dataflow パイプラインを開始します。
以下の形式を指定できます。
inputFilePattern=gs://bucket-name/migration/attempt_1/
inputFilePattern=gs://bucket-name/migration/
inputFilePattern=gs://bucket-name/
サポート対象外:
inputFilePattern=gs://bucket-name/**/*
DATAFLOW_START_TIME="$(date +'%Y%m%d%H%M%S')"
gcloud dataflow flex-template run "dataflow-mongodb-to-firestore-$DATAFLOW_START_TIME" \
--template-file-gcs-location gs://dataflow-templates-us-central1/latest/flex/Cloud_Datastream_MongoDB_to_Firestore \
--region $LOCATION \
--num-workers $NUM_WORKERS \
--temp-location $TEMP_OUTPUT_LOCATION \
--additional-user-labels "" \
--parameters inputFilePattern=$INPUT_FILE_LOCATION,\
inputFileFormat=avro,\
fileReadConcurrency=10,\
connectionUri=$FIRESTORE_CONNECTION_URI,\
databaseName=$FIRESTORE_DATABASE_NAME,\
shadowCollectionPrefix=shadow_,\
batchSize=500,\
deadLetterQueueDirectory=$DLQ_LOCATION,\
dlqRetryMinutes=10,\
dlqMaxRetryCount=500,\
processBackfillFirst=false,\
useShadowTablesForBackfill=true,\
runMode=regular,\
directoryWatchDurationInMinutes=20,\
streamName=$DATASTREAM_NAME,\
stagingLocation=$STAGING_LOCATION,\
autoscalingAlgorithm=THROUGHPUT_BASED,\
maxNumWorkers=$MAX_WORKERS,\
workerMachineType=$WORKER_TYPE
Dataflow パイプラインのモニタリングの詳細については、トラブルシューティングをご覧ください。
次のステップ
Firestore にトラフィックを移行するに進みます。