라이브 데이터 마이그레이션에서는 데이터가 소스 데이터베이스, 대상 Spanner 데이터베이스, 데이터 마이그레이션을 수행하는 데 사용하는 도구 간에 흐르도록 하는 데 필요한 네트워크 인프라를 구성해야 합니다. 조직의 규정 준수 요구사항에 따라 비공개 또는 공개 네트워크 연결을 결정해야 합니다. 인프라를 설정하려면 조직의 네트워크 관리자의 도움이 필요할 수 있습니다.
라이브 데이터 마이그레이션
라이브 데이터 마이그레이션은 다음 두 가지 구성요소로 구성됩니다.
소스 데이터베이스의 일관된 스냅샷에서 데이터 마이그레이션
변경 데이터 캡처(CDC)로 참조되는 해당 스냅샷 이후의 변경 내역(삽입, 업데이트, 삭제) 마이그레이션
라이브 데이터 마이그레이션은 데이터 보호에 도움이 되지만 프로세스에는 다음을 포함한 문제가 발생합니다.
스냅샷이 마이그레이션되는 동안 CDC 데이터 저장
들어오는 CDC 스트림을 캡처하는 동안 CDC 데이터를 Spanner에 작성
CDC 데이터를 Spanner로 마이그레이션하는 작업이 들어오는 CDC 스트림보다 빠르도록 보장
다운타임을 통한 마이그레이션
소스 데이터베이스를 CSV 또는 Avro로 내보낼 수 있으면 다운타임을 통해 Spanner로 마이그레이션할 수 있습니다. 자세한 내용은 Spanner 가져오기 및 내보내기 개요를 참조하세요.
다운타임을 통한 마이그레이션은 몇 시간의 다운타임을 허용할 수 있는 테스트 환경이나 애플리케이션에 사용될 수 있습니다. 라이브 데이터베이스에서는 다운타임을 통한 마이그레이션으로 인해 데이터가 손실될 수 있습니다.
다운타임 마이그레이션을 수행하려면 다음과 같은 대략적인 방식을 사용하는 것이 좋습니다.
애플리케이션을 중지하고 소스 데이터베이스에서 데이터 덤프 파일을 생성합니다.
덤프 파일을 MySQL, PostgreSQL, Avro 또는 CSV 덤프 형식으로 Cloud Storage에 업로드합니다.
Dataflow 또는 Spanner 마이그레이션 도구를 사용하여 덤프 파일을 Spanner에 로드합니다.
Spanner는 여러 덤프 파일을 동시에 읽을 수 있으므로 작은 덤프 파일을 여러 개 생성하면 Spanner에 더 빠르게 쓸 수 있습니다.
소스 데이터베이스에서 덤프 파일을 생성할 때 일관된 데이터 스냅샷을 생성하려면 다음 사항을 고려하세요.
덤프를 수행하기 전에 소스 데이터베이스에 읽기 잠금을 적용하여 덤프 파일 생성 중에 데이터가 변경되지 않도록 합니다.
또는 복제가 사용 중지된 소스 데이터베이스에서 읽기 복제본을 사용하여 덤프 파일을 생성합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-05(UTC)"],[],[],null,["# Migrate your data\n\nAfter optimizing your Spanner schema and migrating your\napplication, you can move your data into an empty production-sized\nSpanner database, and then switch over your application to use\nthe Spanner database.\n\nDepending on your use case, you might be able to perform a live data\nmigration with minimal downtime, or you might require prolonged downtime to\nperform the data migration.\n\nIf your application can't afford a lot of\ndowntime, consider performing a\n[live data migration](#live-data-migration).\nIf your application can handle downtime, you can consider\n[migrating with downtime](#downtime-data-migration).\n\nIn a live data migration, you need to configure the network\ninfrastructure required for data to flow between your source database, the\ntarget Spanner database, and the tools you're using to perform\nthe data migration. You need to decide on either private or public network\nconnectivity depending on your organization's compliance requirements. You\nmight need your organization's network administrator to set up the\ninfrastructure.\n\nLive data migration\n-------------------\n\nA live data migration consists of two components:\n\n- Migrating the data in a consistent snapshot of your source database.\n- Migrating the stream of changes (inserts, updates and deletes) since that snapshot, referred to as change data capture (CDC).\n\nWhile live data migrations help protect your data, the process involves\nchallenges, including the following:\n\n- Storing CDC data while the snapshot is migrating.\n- Writing the CDC data to Spanner while capturing the incoming CDC stream.\n- Ensuring that the migration of CDC data to Spanner is faster than the incoming CDC stream.\n\nMigration with downtime\n-----------------------\n\nIf your source database can export to CSV or Avro, then you can migrate to\nSpanner with downtime. For more information, see\n[Spanner import and export overview](/spanner/docs/import-export-overview).\n\nMigrations with downtime can be used for test environments or\napplications that can handle a few hours of downtime. On a live database, a\nmigration with downtime might result in data loss.\n\nTo perform a downtime migration, consider the following high-level approach:\n\n1. Stop your application and generate a dump file of the data from the source database.\n2. Upload the dump file to Cloud Storage in a MySQL, PostgreSQL, Avro, or CSV dump format.\n3. Load the dump file into Spanner using Dataflow or the Spanner migration tool.\n\nGenerating multiple small dump files makes it quicker to write to\nSpanner, as Spanner can read multiple dump files\nin parallel.\n\nWhen generating a dump file from the source database, keep the following in mind\nto generate a consistent snapshot of data:\n\n- Before you perform the dump, apply a read lock on the source database to prevent the data from changing during the generation of the dump file.\n- Alternatively, generate the dump file using a read replica from the source database with replication disabled.\n\nSource specific guides\n----------------------\n\n- MySQL: [MySQL live data migration](/spanner/docs/mysql-live-data-migration)."]]