Menulis data ke database Firestore

Halaman ini menjelaskan tahap kedua dari proses migrasi saat Anda menyiapkan pipeline Dataflow dan memulai pemindahan data serentak dari bucket Cloud Storage ke database Firestore dengan kompatibilitas MongoDB tujuan Anda. Operasi ini akan berjalan secara bersamaan dengan aliran Datastream.

Mulai pipeline Dataflow

Perintah berikut memulai pipeline Dataflow baru dengan nama unik.

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

Untuk mengetahui informasi selengkapnya tentang pemantauan pipeline Dataflow, lihat Pemecahan masalah.

Langkah berikutnya

Lanjutkan ke Migrasikan traffic ke Firestore.