다운타임 없이 OCI GoldenGate에서 MongoDB까지 Oracle Database로 전환하는 방법을 살펴보세요.
OCI GoldenGate Big Data는 다운타임 없이 MongoDB 및 MongoDB Atlas에서 Oracle Autonomous JSON Database, Oracle Autonomous Database 및 Oracle Database로의 마이그레이션을 지원합니다. 자율운영 JSON 데이터베이스 및 Oracle Autonomous Database에는 OCI GoldenGate이 대상 Oracle Database 시스템에 연결하는 데 사용하는 사전 구성된 Oracle API for MongoDB 연결 문자열이 함께 제공됩니다. 자세한 내용은 Using Oracle Database API for MongoDB을 참조하십시오. 대상이 온프레미스 Oracle Database인 경우 Oracle Rest Data Services를 사용하여 온프레미스 Oracle Database에서 Oracle Database API for MongoDB를 사용으로 설정할 수 있습니다.
mongodump가 있는 동일한 디렉토리에서 소스 MongoDB의 OplongLSN.sh 스크립트를 실행하여 다음과 같이 위치를 oplog.bson에 인수로 전달합니다.
$./oplogLSN.sh /path/to/dump/oplog.bson
이 명령은 다음을 반환합니다.
<date+timestamp> 1 objects found
First LSN: 1740663867.1
Last LSN: 1740663946.211
Oplog 항목을 검사합니다. 덤프 중 들어오는 작업이 있는 경우 oplog.bson 파일에는 각 작업에 대한 항목이 시간 기록이 포함된 항목이 포함됩니다. OplogLSN.sh를 사용하여 첫 번째 및 마지막 작업 시간 기록을 캡처하거나 이전 단계에 표시된 대로 수동 검사를 위해 JSON 파일로 변환할 수 있습니다.
MongoDB 복원 유틸리티를 실행합니다. mongorestore 유틸리티를 사용하여 선택한 모음을 덤프에서 대상 MongoDB 인스턴스로 복원합니다.
<date+timestamp> using write concern: &{majority <nil> 0s}
<date+timestamp> using default 'dump' directory
<date+timestamp> preparing collections to restore from
<date+timestamp> found collection admin.system.version bson to restore to admin.system.version
<date+timestamp> found collection metadata from admin.system.version to restore to admin.system.version
<date+timestamp> don't know what to do with file "dump/oplog.json", skipping...
<date+timestamp> found collection testDB.coll1 bson to restore to testDB.coll1
<date+timestamp> found collection metadata from testDB.coll1 to restore to testDB.coll1
<date+timestamp> found collection testDB.coll2 bson to restore to testDB.coll2
<date+timestamp> found collection metadata from testDB.coll2 to restore to testDB.coll2
<date+timestamp> reading metadata for testDB.coll1 from dump/testDB/coll1.metadata.json
<date+timestamp> reading metadata for testDB.coll2 from dump/testDB/coll2.metadata.json
<date+timestamp> creating collection testDB.coll1 with no metadata
<date+timestamp> creating collection testDB.coll2 with no metadata
<date+timestamp> restoring testDB.coll1 from dump/testDB/coll1.bson
<date+timestamp> restoring testDB.coll2 from dump/testDB/coll2.bson
<date+timestamp> finished restoring testDB.coll1 (10000 documents, 0 failures)
<date+timestamp> finished restoring testDB.coll2 (10000 documents, 0 failures)
<date+timestamp> no indexes to restore for collection testDB.coll1
<date+timestamp> no indexes to restore for collection testDB.coll2
<date+timestamp> 20000 document(s) restored successfully. 0 document(s) failed to restore.
이 명령은 지정된 모음에 대한 데이터, 메타데이터 및 인덱스 정의를 대상 MongoDB/ORDS 인스턴스로 복원합니다. 예를 들어, 위의 출력에 표시된 것처럼 testDB 데이터베이스의 coll1 및 coll2입니다.
MongoDB에 대한 소스 빅데이터 배포에서 변경 데이터 캡처(CDC) 추출 생성 및 실행. 2b단계에서 얻은 첫번째 작업 시간 기록(첫번째 LSN)에서 MongoDB CDC Extract를 시작합니다. 이렇게 하면 CDC Extract가 덤프 프로세스 시작 후 발생하는 작업을 캡처합니다.
oplongReplayLastLsn를 2b단계에서 얻은 마지막 작업 시간 기록(마지막 LSN)으로 설정하거나 oplog.bson 및 마지막 LSN에 대한 경로를 자동으로 가져옵니다. 이렇게 하면 Replicat가 oplong-replay 모드로 실행되어 충돌을 방지하고 데이터 손실이나 복제 없이 정확한 시작을 보장합니다. 마지막 시간 기록이 처리된 후 Replicat는 일반 모드로 계속됩니다.
권고 사항
다음은 원활한 마이그레이션을 보장하기 위한 몇 가지 팁입니다.
mongodb-database-tools 버전 100.10.0 이하를 사용하는 것이 좋습니다.
mongodump를 실행하기 전에 기존 덤프 폴더를 정리하여 불일치 데이터를 삭제합니다.
MongoDB 복원: mongorestore 명령의 여러 --nsInclude 옵션을 사용하여 여러 데이터베이스 모음을 복제할 수 있습니다. 그러나 ORDS 다중 데이터베이스는 다중 --nsInclude 명령을 사용하여 복원할 수 없습니다. 복원할 각 데이터베이스에 대해 하나씩 여러 개의 복원 명령을 사용해야 합니다.