Firestore 데이터베이스에 데이터 쓰기

이 페이지에서는 마이그레이션 프로세스의 두 번째 단계를 설명합니다. 이 단계에서는 Dataflow 파이프라인을 설정하고 Cloud Storage 버킷에서 MongoDB 호환성을 갖춘 대상 Firestore 데이터베이스로 동시 데이터 이동을 시작합니다. 이 작업은 Datastream 스트림과 동시에 실행됩니다.

Dataflow 파이프라인 시작

다음 명령어는 고유한 이름의 새 Dataflow 파이프라인을 시작합니다.

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로 마이그레이션으로 진행합니다.