AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

마이그레이션 대상: mongomirror

mongomirror is a tool for manually migrating data from an existing MongoDB replica set to a MongoDB Atlas replica set. See Download mongomirror.

mongomirror는 기존 복제본 세트 또는 애플리케이션을 종료할 필요가 없습니다. 또한 사용자 또는 역할 데이터를 가져오지 않으며 config 데이터베이스를 복사하지 않습니다.

다음과 같은 경우 mongomirror를 사용하세요.

  • MongoDB Atlas 외부에서 호스팅되는 MongoDB 배포에서 MongoDB Atlas 클러스터로 데이터 세트 마이그레이션을 1회 실행합니다.

  • 한 Atlas 클러스터에서 다른 Atlas 클러스터로 데이터 세트 마이그레이션을 1회 실행합니다.

또한 데이터 가져오기 및 마이그레이션 도구 선택을 참조하세요.

  • The source MongoDB deployment must be a replica set. If the source is a standalone MongoDB deployment, before running mongomirror, convert the standalone to a replica set.

  • 소스 복제본 세트는 MongoDB 버전 2.6 이상을 실행해야 합니다.

  • 소스 MongoDB 복제본 세트 무료 클러스터 (이전의 M0) 또는 Flex 클러스터 일 수 없습니다.

  • 절차 중 어떤 경우에도 featureCompatibilityVersion 플래그를 변경하지 않습니다.

  • MongoDB 4.4 이하에서 MongoDB 7.0 이상을 실행하는 Atlas 클러스터로 마이그레이션하는 경우, 컬렉션에서 geoHaystack 인덱스를 제거하세요.

  • mongomirror is not compatible with TTL indexes. Drop any existing TTL indexes and rebuild them when the migration process is complete. If you do not want to drop an existing index because it is important for query performance, contact support for alternative options.

  • Don't make any namespace changes during the migration process, such as using the renameCollection command or executing an aggregation pipeline that includes the $out aggregation stage.

  • You can't use the renameCollection command or the $out aggregation stage as part of initial sync, which runs as a part of the mongomirror process.

  • 마이그레이션의 초기 동기화 단계에서는 프라이머리를 재시작하지 않도록 합니다.

  • If your MongoDB deployment contains indexes with keys which exceed the Index Key Limit, before you start the live migration procedure, modify indexes so that they do not contain oversized keys.

mongomirror는 소스 복제본 세트에 대한 네트워크 액세스 권한이 있어야 합니다. 소스 복제본 세트에 인증이 필요한 경우 mongomirror를 실행할 때 사용자 자격 증명을 포함하세요. 최소한 다음 권한을 가진 데이터베이스 사용자를 지정합니다.

If no such user exists, create the user in your source MongoDB replica set. Different MongoDB Server versions have different built-in roles. Select a built-in role based on your MongoDB Server version and run the appropriate commands in the mongosh:

  • For source clusters a user must have the readAnyDatabase, clusterMonitor, and backup roles.

    To verify that the database user who will run the live migration process has these roles, run the db.getUser() command on the admin database.

    use admin
    db.getUser("admin")
    {
    "_id" : "admin.admin",
    "user" : "admin",
    "db" : "admin",
    "roles" : [
    {
    "role" : "backup",
    "db" : "admin"
    },
    {
    "role" : "clusterMonitor",
    "db" : "admin"
    }
    {
    "role" : "readAnyDatabase",
    "db" : "admin"
    }
    ]
    } ...

    이외에도 소스 클러스터의 데이터베이스 사용자는 데이터베이스의 oplog를 읽을 수 있는 역할이 있어야 admin 합니다. 자세히 알아보려면 Oplog 액세스를참조하십시오.

  • For source clusters running MongoDB 3.4 a user must have, at a minimum, both clusterMonitor and readAnyDatabase roles. For example:

    use admin
    db.createUser(
    {
    user: "mySourceUser",
    pwd: "mySourceP@$$word",
    roles: [ "clusterMonitor", "readAnyDatabase" ]
    }
    )
  • For source clusters running MongoDB 3.2 a user must have, at a minimum, both clusterManager and readAnyDatabase roles, as well as read access on the local database. This requires a custom role, which you can create with the following commands:

    use admin
    db.createRole(
    {
    role: "migrate",
    privileges: [
    { resource: { db: "local", collection: "" }, actions: [ "find" ] }
    ],
    roles: ["readAnyDatabase", "clusterManager"]
    }
    )
    db.createUser(
    {
    user: "mySourceUser",
    pwd: "mySourceP@$$word",
    roles: [ "migrate" ]
    }
    )
  • For source clusters running MongoDB 2.6 or 3.0 a user must have, at a minimum, the readAnyDatabase role. For example:

    use admin
    db.createUser(
    {
    user: "mySourceUser",
    pwd: "mySourceP@$$word",
    roles: [ "readAnyDatabase" ]
    }
    )

대상 Atlas 배포:

  • 무료 클러스터 또는 Flex 클러스터 일 수 없습니다.

  • 복제본 세트이어야 합니다.

  • Must have the version that is the same as or later than the source cluster MongoDB version. See Upgrade Path.

  • 소스 클러스터와 겹치는 네임스페이스를 포함해서는 안 됩니다. mongomirror 2}가 대상 클러스터에서 겹치는 네임스페이스를 감지하는 경우 프로세스를 시작하기 전에 실패합니다. 대상 클러스터에 네임스페이스가 겹치는 경우 --drop를 사용하여 대상 클러스터에서 데이터를 모두 삭제하거나 --includeNamespace사용하여 소스 클러스터에서 가져올 네임스페이스를 나열합니다.

  • 다음 중 하나의 IP 액세스 목록에도 포함되어야 합니다.

    • mongomirror가 실행 중인 서버의 공용 IP 주소 또는

    • VPC 피어링을 설정한 경우, 상대방의 VPC CIDR 블록(또는 서브넷) 또는 상대방 VPC의 보안 그룹(Security Group) 중 하나를 사용해야 합니다.

    참고

    클러스터 내 임의의 노드에 대한 공용 IP 주소를 찾으려면 명령줄에서 nslookup 도구를 사용합니다. 자세한 내용은 Atlas 클러스터의 공용 IP가 변경되나요?를 참조하세요.

mongomirror 대상 클러스터에 대한 네트워크 액세스 권한이 있어야 합니다.

You must specify a database user with the Atlas admin role to run mongomirror. To learn more, see Configure Database Users.

중요

mongomirror 는 MongoDB 6.0+ 소스 클러스터와 6.0+ 대상 클러스터 간의 마이그레이션에는 지원되지 않습니다. 를 사용하여 소스 복제본 세트 에서 마이그레이션 할 mongomirror 수 60 없습니다..x 이상을 대상 복제본 세트 6에 추가합니다.0.x 또는 그 이후 버전.

를 사용하여 이전 버전의 소스 복제본 세트 mongomirror 6.0 에서 MongoDB 버전 이 있는 대상 복제본 세트 로 마이그레이션 할 수 있습니다.

Alternatively, you can upgrade your source replica set to 6.0+ or 7.0+ and use this live migration procedure to migrate an upgraded replica set to Atlas.

mongomirror 다음 마이그레이션 경로를 지원합니다.

소스 복제본 세트
MongoDB 버전
대상 Atlas 복제본 세트
MongoDB 버전

5.0

6.0

4.4

6.0

4.2

6.0

4.0

6.0

3.6

6.0

3.4

6.0

3.2

6.0

3.0

6.0

2.6

6.0

참고

macOS 64비트에서 mongomirror 파일 다운로드한 후 처음으로 열려고 하면 보안 경고 나타납니다. 계속하려면 보안 설정을 재정의하여 앱 열기를 참조하세요.

mongomirror를 시작하면 다음과 같은 작업이 수행됩니다.

  1. TLS를 통해 Atlas에 연결합니다.

  2. 초기 동기화를 수행하면 기존 MongoDB 복제본 세트의 컬렉션이 Atlas의 대상 클러스터로 복사됩니다.

  3. 초기 동기화 후 수신 변경 사항에 대해 복제본 세트의 oplog 지속적으로 테일링하고 Atlas 의 대상 클러스터 에서 이를 재생합니다. mongomirror config 는 데이터베이스 복사하지 않습니다. mongomirror 는 소스 또는 대상 클러스터 에서 와이어 압축을 활성화 경우 이를 사용하고 을(를) 사용하여 허용할 압축 라이브러리를 --compressors 지정합니다.

    mongomirror builds all indexes on the destination cluster in the foreground, regardless of how the indexes were built on the source cluster. Foreground index builds block all other operations on the database. To learn more, see Index Build Operations on a Populated Collection.

mongomirror는 일단 시작되면 종료될 때까지 계속 실행됩니다.

1

If the source replica set requires authentication, you must include user credentials when running mongomirror. For requirements, see Required Access on Source Replica Set.

mongomirror 실행하는 경우 이러한 자격 증명을 지정해야 하기 때문에 새 사용자에 대해 선택한 사용자 이름과 패스워드 기록해 둡니다.

2
  1. 아직 표시되지 않은 경우 탐색 표시줄의 Organizations 메뉴에서 프로젝트가 포함된 조직을 선택합니다.

  2. 아직 표시되지 않은 경우 내비게이션 바의 Projects 메뉴에서 프로젝트를 선택합니다.

  3. 사이드바에서 Security 제목 아래의 Database & Network Access를 클릭합니다.

The Database & Network Access page displays after you complete the preceding steps.

3

You must specify a database user with the Atlas admin role to run mongomirror. See Configure Database Users for documentation on creating a database user.

해당 사용자가 없는 경우 사용자를 만듭니다:

  1. 아직 표시되지 않은 경우 Database Users 탭을 클릭합니다.

  2. 딸깍 하는 소리 Add New Database User.

  3. Atlas admin 0} 사용자를 추가합니다.

mongomirror 실행하는 경우 이러한 자격 증명을 지정해야 하기 때문에 새 사용자에 대해 선택한 사용자 이름과 패스워드 기록해 둡니다.

4

mongomirror를 실행할 호스트가 원하는 클러스터의 IP 액세스 목록에 없으면 이 목록을 업데이트하세요. 다음 두 가지 중 하나를 지정할 수 있습니다.

  • mongomirror 실행될 서버의 공인 IP 주소 혹은

  • VPC 피어링을 설정한 경우, 상대방의 VPC CIDR 블록(또는 서브넷) 또는 상대방 VPC의 보안 그룹(Security Group) 중 하나를 사용해야 합니다.

5
  1. 아직 표시되지 않은 경우 탐색 표시줄의 Organizations 메뉴에서 원하는 프로젝트가 포함된 조직을 선택합니다.

  2. 아직 표시되지 않은 경우 탐색 표시줄의 Projects 메뉴에서 원하는 프로젝트를 선택합니다.

  3. 사이드바에서 Database 제목 아래의 Clusters를 클릭합니다.

Clusters(클러스터) 페이지가 표시됩니다.

6

데이터를 마이그레이션할 Atlas 클러스터의 Connect를 클릭합니다.

7

Atlas 클러스터의 호스트 이름 정보는 Atlas 사용자 인터페이스에서 확인할 수 있습니다.

참고

mongomirror로 데이터를 마이그레이션할 때는 드라이버를 사용할 필요가 없습니다.

  1. Connect 대화 상자에서 Shell을 클릭합니다.

  2. 드롭다운 목록에서 3.4 or earlier 선택합니다. 연결 문자열은 다음과 같은 예시와 유사해야 합니다. 이러한 예시는 가독성을 위해 여러 줄로 나뉘어져 있습니다.

    mongodb://<db_username>:<db_password>@
    00.foo.mongodb.net:27017,
    01.foo.mongodb.net:27017,
    02.foo.mongodb.net:27017/test?
    ssl=true&replicaSet=myAtlasRS&authSource=admin
  3. 다음 예시와 같이 텍스트 편집기에서 replicaSet 값을 붙여 넣고 전방 슬래시(/)를 추가한 다음, 호스트 목록을 쉼표로 구분된 값으로 추가하세요.

    myAtlasRS/00.foo.mongodb.net:27017,01.foo.mongodb.net:27017,02.foo.mongodb.net:27017

다음 단계에서 --destination 에 이 값을 사용합니다.

8

마이그레이션 프로세스를 완료하려면 데이터 전송을 확인하고 Atlas로 전환합니다.

mongomirror 초기 동기화를 완료하고 복제본 세트의 oplog를 추적한 후 대상 Atlas 클러스터로 전환할 수 있습니다.

1

이렇게 하면 소스 클러스터에서 쓰기가 추가로 발생하지 않습니다.

2

이는 소스 클러스터와 대상 클러스터가 일관적인 상태임을 나타냅니다.

3

Atlas 클러스터가 최신 버전이 되면 mongomirror 중지합니다.

4

다음 검증 전략 중 하나를 사용하여 데이터가 대상 클러스터로 전송되었는지 확인합니다. 소스 또는 대상 클러스터가 데이터를 쓰고 있지 않음을 확인한 후에만 다음 검증 방법을 사용하세요.

  • Use the db.collection.countDocuments() method on each collection on the source and the destination clusters to obtain document counts and compare them between the clusters.

  • 소스 클러스터의 컬렉션을 쿼리한 다음 대상 클러스터에 동일한 값을 가진 올바른 문서, 인덱스, 컬렉션, 메타데이터 및 보기가 존재하는지 확인하는 스크립트를 작성합니다. 스크립트에서 소스 및 대상 클러스터에 다음 명령을 사용하세요.

5

cluster 패널의 Connect 버튼을 통해 제공된 Atlas 연결 문자열로 클라이언트 애플리케이션을 업데이트하세요.

Atlas 연결에 대한 자세한 내용은 클라이언트 라이브러리를 통해 클러스터에 연결하기를 참조하세요.

mongomirror진행 상황을 터미널의 표준 출력에 기록합니다. 초기 동기화가 진행되는 동안 mongomirror 복사하는 각 collection에 대해 진행 표시줄을 기록합니다. 예시:

2024-08-09T16:35:50.227-0000 [#....................] park.events 2179/34184 (6.4%)
2024-08-09T16:35:50.227-0000 [#############........] zoo.animals 29000/49778 (58.3%)

oplog를 테일링할 경우 mongomirror 소스 클러스터의 가장 최근 oplog 항목과 대상 클러스터에서 마지막으로 처리된 oplog 항목 간의 지연 시간(단위: 초)을 기록합니다. 예시:

2024-12-12T16:22:17.027-0800 Current lag from source: 6s

지연 시간이 6초라는 것은 마지막으로 처리된 mongomirror oplog 항목이 소스 클러스터에서 사용 가능한 가장 최근 항목보다 6초 전에 발생했다는 의미입니다.

참고

mongomirror를 사용해서 따라잡기까지 걸리는 시간은 초당 유입되는 항목의 수에 따라 6초보다 많을 수도 있고 적을 수도 있습니다.

지연 시간이 0초라는 것은 mongomirror가 최신 oplog 항목보다 1초 이내에 빨리 유입된 항목을 처리 중이라는 뜻입니다.

소스 클러스터에 인덱스가 있다면 mongomirror가 대상 클러스터에서 동일한 인덱스를 구축합니다. 진행 로그에는 인덱스 구축 프로세스의 시작 시간과 종료 시간이 표시됩니다. 인덱스 빌드의 진행 상황을 보려면 다음 두 가지 방법 중 하나를 사용하면 됩니다.

  • 대상 cluster의 프라이머리 노드에서 currentOp 명령어를 사용합니다. command 필드는 실행 중인 작업에 대한 정보를 표시합니다. 인덱스 생성 항목은 다음과 유사합니다.

    "command" : {
    "createIndexes" : "perfs",
    "indexes" : [
    {
    "key" : {
    "animal" : "text"
    },
    "name" : "animal_text"
    }
    ]...
  • 대상 클러스터에 대한 mongodb 로그를 다운로드하고 인덱스 관련 라인의 최근 항목을 검색합니다. 인덱스 작성과 관련된 로그 메시지는 다음과 유사하게 표시됩니다.

    {"t":{"$date":"2024-08-09T16:35:50.227+00:00"},"s":"I", "c":"INDEX", "id":20447, "ctx":"conn1080","msg":"Index build: completed","attr":{"buildUUID":{"uuid":{"$uuid":"c4a62739-bf19-456d-bbd6-7baa29f1063b"}}}}

To avoid contention for network and CPU resources, run mongomirror on hosts other than your replica set's mongod instance hosts.

  • mongomirror 은(는) 소스 복제본 세트의 성능에 보조로 설정할 때와 비슷한 영향을 미칩니다.

    • 초기 동기화 단계에서는 데이터 세트의 크기에 따라 로드가 확장됩니다.

    • 초기 동기화가 완료되면 시간당 사용되는 oplog 기가바이트에 따라 로드가 확장됩니다.

mongomirror의 구문, 옵션 및 예시는 mongomirror 참조 페이지를 참조하세요.