경고
mongomirror을 네임스페이스 필터와 함께 사용하는 경우, includeNamespace <database.collection>의 범위를 벗어난 네임스페이스가 있는 소스의 트랜잭션은 정의되지 않은 동작으로 간주되어 잠재적인 데이터 손실을 초래합니다.
mongomirror 는 기존 MongoDB 복제본 세트에서 MongoDB Atlas 복제본 세트로 데이터를 수동으로 마이그레이션하는 도구입니다. mongomirror 다운로드를 참조하세요.
구문
mongomirror을(를) 실행하려면 다음을 지정해야 합니다.
소스 복제본 세트와 대상 Atlas 복제본 세트
mongomirror --host <sourceReplSet> \ --destination <atlasCluster> \ --destinationUsername <atlasAdminUser> \ --destinationPassword <atlasPassword> \ [Additional options]
You can specify some options in the config file instead of including them in the command.
옵션
--host <host>소스 복제본 세트의 호스트 정보입니다. 다음과 같이 복제본 세트 이름과 노드의 시드 목록을 지정합니다.
<RSname>/<host1>:<port1>,<host2>:<port2>,<host3>:<port3>
--username <username>If the source replica set requires authentication, the name of a user in the source replica set with privileges to read any database, including the
localdatabase. A user with thebackuprole provides the appropriate privileges. For details on the specific privileges required, see Required Access on Source Replica Set.
--authenticationDatabase <authenticationDatabase>--username에 지정된 사용자가 생성된 소스 복제본 세트의 데이터베이스입니다. 다음에 대한 인증 데이터베이스입니다.SCRAM 인증 사용자는
admin데이터베이스입니다.X.509 인증 사용자는
$external데이터베이스입니다.AWS IAM 인증 사용자는
$external데이터베이스입니다.
To learn more, see Authentication Database.
--authenticationMechanism <authenticationMechanism>소스 복제본 세트에 대해 사용자를 인증하는 데 사용하는 인증 메커니즘입니다.
값설명SHA- 해시 함수를 사용하는RFC 표준 솔티드 챌린지 응답 인증 메커니즘.5802 1
SHA- 해시 함수를 사용하는RFC 표준 솔티드 챌린지 응답 인증 메커니즘.5802 256
MongoDB TLS/SSL 인증서 인증.
GSSAPI (Kerberos)
External authentication using Kerberos. This mechanism is available only in MongoDB Enterprise.
PLAIN (LDAP SASL)
External authentication using LDAP. You can also use
PLAINfor authenticating in-database users.PLAINtransmits passwords in plain text. This mechanism is available only in MongoDB Enterprise.MONGODB-IAM
버전 0.10.0의 새로운 기능
Amazon Web Services IAM을 사용한 외부 인증 .
AWS IAM 자격 증명으로 인증하려면 다음 옵션을 사용하세요.
--username<AWS access key id>--password<secret access key id>--awsSessionToken<AWS session token>
To learn more, see Authentication Mechanisms.
--compressors <snappy,...>버전 1.5.0의 새로운 기능
활성화할 압축기 목록을 쉼표로 구분합니다. 비활성화하려면 'none'을 사용하세요. 기본값:
snappy,zstd,zlib
--config=<file>mongomirror의 옵션과 값을 저장하는 YAML 파일입니다. 상대 경로 또는 절대 경로를 사용하여mongomirror파일에 포함된 옵션과 함께 실행할 파일을 지정합니다.구성 파일은 다음 옵션을 지원합니다.
password<password>sslPEMKeyPassword<password>destinationPassword<password>uri<source cluster URI connection string>
option: value구문을 사용하여 구성 파일에서 옵션을 지정합니다. 구성 파일의 옵션 앞에--을(를) 포함하지 마세요. 구성 파일에 옵션을 설정한 경우mongomirror명령어 내에서 해당 옵션을 지정할 필요가 없습니다.예시
다음을 포함하는
myconfig.yaml(이)라는 구성 파일을 만듭니다.password: <passwordForUser> destinationPassword: <passwordForDestinationUser> --password및--destinationPassword플래그를 포함하지 않고mongomirror를 실행할 수 있습니다.mongomirror --host <sourceReplSet> \ --ssl \ --username <atlasAdminUser> \ --destinationUsername <atlasAdminUser> \ --config=myconfig.yaml \ --destination <atlasCluster> \ [Additional options]
--destination <destination>대상 Atlas 복제본 세트의 호스트 정보입니다.
다음과 같이 복제본 세트 이름과 노드의 시드 목록을 지정합니다.
<RSname>/<host1>:<port1>,<host2>:<port2>,<host3>:<port3>
--destinationAuthenticationDatabase <authentication database>Authentication database for the database user in the Atlas cluster. The authentication database for SCRAM-authenticated users is the
admindatabase.자세한 내용은 데이터베이스 사용자 인증을 참조하세요.
--destinationAuthenticationMechanism <authentication mechanism>Atlas 클러스터의 데이터베이스 사용자를 위한 인증 메커니즘입니다. Atlas는 데이터베이스 사용자를 위해 다음과 같은 인증 형식을 제공합니다.
값설명SHA- 해시 함수를 사용하는RFC 표준 솔티드 챌린지 응답 인증 메커니즘.5802 1
SHA- 해시 함수를 사용하는RFC 표준 솔티드 챌린지 응답 인증 메커니즘.5802 256
PLAIN (LDAP SASL)
External authentication using LDAP. You can also use
PLAINfor authenticating in-database users.PLAINtransmits passwords in plain text. This mechanism is available only in MongoDB Enterprise.자세한 내용은 데이터베이스 사용자 인증을 참조하세요.
--destinationUsername <Atlas user name>데이터베이스를 읽고, 쓰고, 관리할 수 있는 권한이 있는 Atlas 클러스터의 데이터베이스 사용자 이름입니다. Atlas 관리자 역할이 있는 사용자는 적절한 권한을 제공합니다. 필요한 특정 권한에 대한 자세한 내용은 대상 클러스터에 필요한 액세스권한을 참조하세요.
--dropFlag that indicates that
mongomirrorshould drop all user collections (viewable in each database withlistCollections) on the target cluster. This option doesn't drop internal collections likelocal.system*and the oplog.
--includeNamespace <database.collection>소스 클러스터에서 대상 클러스터에 미러링할 네임스페이스를 지정합니다. 여러 차례 제공될 수 있습니다.
참고
If a transaction spans multiple namespaces, only write operations applied to the namespaces specified in
--includeNamespaceor--includeDBare applied to the destination cluster.
--includeDB <database>소스 클러스터에서 대상 클러스터에 미러링할 데이터베이스를 지정합니다. 여러 차례 제공될 수 있습니다.
참고
If a transaction spans multiple namespaces, only write operations applied to the namespaces specified in
--includeNamespaceor--includeDBare applied to the destination cluster.
--sslPEMKeyFile <file>소스 복제본 세트에서 클라이언트가 인증서를 제시해야 하는 경우에 해당하는 .pem 파일입니다..pem 파일에는 TLS/SSL 인증서 및 키가 모두 포함되어 있습니다.상대 경로 또는 절대 경로를 사용하여 파일을 지정합니다.
--sslPEMKeyPassword <value>--sslPEMKeyFile에 지정된 인증서 키 파일을 해독하기 위한 비밀번호입니다.--sslPEMKeyFile이(가) 암호화된 경우 사용합니다.
--sslCAFile <file>소스 복제본 세트에 대한 인증 기관(CA)의 최상위 인증서 체인이 포함된 .pem 파일입니다. 상대 경로 또는 절대 경로를 사용하여 파일을 지정합니다.
--sslAllowInvalidHostnames더 이상 사용되지 않습니다. 다음을 사용하세요.
tlsInsecure대신Disables the validation of the TLS/SSL certificates presented by the source replica set. Allows
mongomirrorto connect to the source replica set if the hostname in the certificates does not match the specified hostname.중요
이 옵션은 모든 인증서 유효성 검사를 건너뛰므로 잘못된 인증서를 수락하게 될 수도 있습니다.
--sslAllowInvalidCertificates더 이상 사용되지 않습니다. 다음을 사용하세요.
tlsInsecure대신소스 복제본 세트에서 제공하는 인증서에 대한 유효성 검사를 우회합니다.
--allowInvalidCertificates설정을 사용할 때 MongoDB는 유효하지 않은 인증서 사용에 대한 경고를 로그합니다.중요
이 옵션은 모든 인증서 유효성 검사를 건너뛰므로 잘못된 인증서를 수락하게 될 수도 있습니다.
--tlsInsecure서버의 인증서 체인 및 호스트 이름에 대한 유효성 검사를 건너뜁니다. 이렇게 하면 잘못된 인증서 및 호스트 이름을 사용할 수 있습니다.
이는 지원이 중단된
sslAllowInvalidHostnames및sslAllowInvalidCertificates옵션을 대체합니다.
--gssapiServiceName <name>소스 복제본 세트가 Kerberos 인증을 사용하는 경우 GSSAPI/Kerberos를 사용하는 서비스의 이름입니다. 서비스가 기본 이름인
mongodb을(를) 사용하지 않는 경우에만 필요합니다.이 옵션은 MongoDB Enterprise에서만 사용할 수 있습니다.
--gssapiHostName <host>소스 복제본 세트가 Kerberos 인증을 사용하는 경우 GSSAPI/Kerberos를 사용하는 서비스의 호스트 이름입니다. 시스템의 호스트 이름이 DNS에서 확인한 호스트 이름과 일치하지 않는 경우에만 필요합니다.
이 옵션은 MongoDB Enterprise에서만 사용할 수 있습니다.
--readPreference <read preference>버전 0.9.0부터 더 이상 사용되지 않음
mongomirror소스가 복제본 세트 이름이 없는 단일 호스트인 경우를 제외하고는 항상 프라이머리에서 읽습니다. 이 경우 해당 호스트에만 직접 연결됩니다.
--writeConcern <write concern>0.2.3 버전부터 더 이상 사용되지 않습니다.
mongomirror항상 과반수 쓰기 고려를 사용합니다.
--bypassDocumentValidation0.2.3 버전부터 더 이상 사용되지 않습니다.
mongomirror항상 문서 유효성 검사를 건너뜁니다.
--forceDumpFlag that indicates that
mongomirrorresync all source collections, even if a nonempty bookmark file exists.
--oplogPath <path>버전 0.5.0의 새로운 기능
Enables
mongomirrorto buffer the initial sync oplog window to disk. When you specify a value for this option,mongomirrorstreams the source oplog entries to the specified directory in a single file:<oplogPath>/oplog-mongomirror.bson.sz. After the entire oplog file is replayed to the destination cluster,mongomirrorremoves the file and starts tailing the source oplog without buffering.By default,
mongomirrorstreams oplog entries from the source and applies them to the destination cluster. However, the migration may fail if the source oplog is not large enough to contain the entire initial sync oplog window. To avoid this error, you can either increase the size of the source oplog, or specify this option to ensure that the source oplog will not run out of space during the migration process.중요
There must be enough disk space to accommodate all of the source oplog entries that occur during the initial
mongomirrorsync.For example, if the source oplog is 10 GB and covers 24 hours of changes, and
mongomirror's sync is estimated to take 48 hours, there must be at least 20 GB of free disk space in the specified directory.
--oplogBatchSize <num>기본값: 10,000
Specify the number of oplog entries to send as a batch.
mongomirrorallows up to a maximum data volume size of 16 MB of documents to send as a batch.
--httpStatusPort <num>Directs
mongomirrorto start an HTTP server on the specified port. You can retrieve the current status ofmongomirrorby issuing an HTTPGETrequest tohttp://localhost:<num>.When running with
--httpStatusPort,mongomirrordoes not exit when it encounters an error. Instead, it logs the error as normal and reports the error over HTTP to the specified port.mongomirrorHTTP 요청에 대한 응답으로 문서를 반환합니다.다음 예시 구문은 가능한 모든 출력 필드를 나타내며, 실제 응답은 이러한 필드의 하위 집합만 반환할 수 있습니다.필드에 대한 설명과 예상 시기는 다음 표를 참조하세요.{ "stage" : "<stage Name>", "phase" : "<phase Name>", "details" : { "currentTimestamp" : "<BSON timestamp>", "latestTimestamp" : "<BSON timestamp>", "lastWriteOnSourceTimestamp" : "<BSON timestamp>", "<namespace>" : { "complete" : <boolean>, "copiedBytes" : <integer>, "totalBytes" : <integer>, "createIndexes" : <integer> }, ... }, "errorMessage" : "<error message>" } 다음 표에서는 각 필드와 사용 가능한 값에 대해 설명합니다:
필드설명stage진행 중인 단계의 이름입니다. 가능한 값은 다음과 같습니다.
initializingmongomirror시작되었지만 아직 어떤 데이터도 복사하고 있지 않습니다.initial syncmongomirroris copying documents and indexes that already exist on the source deployment.mongomirroralso tails and applies entries from the oplog.oplog syncmongomirroroplog의 엔트리를 테일링하여 적용하고 있습니다.
phase단계의 이름입니다.
stage의 어떤 부분이 진행 중인지에 대한 보다 구체적인 세부 정보를 제공합니다.details현재 단계의 진행 상황에 대한 자세한 설명을 제공하는 문서입니다.
During the
initial syncstage, each subdocument indetailsrepresents a single collection being copied bymongomirror.stage또는phase에 따라mongomirror가 응답에 이 필드를 포함하지 않을 수도 있습니다.details.<namespace>복사되는 컬렉션의 전체 네임스페이스이며
<database>.<collection>(으)로 표시됩니다.문서 또는 인덱스를 복사할 때
initial sync단계에서만 표시됩니다.details.<namespace>.completeDisplays
trueorfalsedepending on whether or notmongomirrorhas copied all documents or indexes from the collection to the target Atlas cluster.문서 또는 인덱스를 복사할 때
initial sync단계에서만 표시됩니다.details.<namespace>.copiedBytes지금까지 복사된 바이트 수입니다. 이는 복사된 현재의
mongomirror총 문서 수를 보고하는 로그와는 다른 측정값입니다.비인덱스 데이터를 복사할 때
initial sync단계 중에만 표시됩니다.details.<namespace>.totalBytescollection의 총 크기(바이트)입니다.
비인덱스 데이터를 복사할 때
initial sync단계 중에만 표시됩니다.details.<namespace>.createIndexes생성되었거나 생성될 인덱스의 수입니다.
인덱스를 복사할 때
initial sync단계에서만 표시됩니다.details.currentTimestampThe BSON timestamp value of the oplog entry most recently processed.
mongomirroronly refreshes this data point every 10 seconds, somongomirrormay be slightly further ahead of the reported time.oplog 엔트리를 테일링하거나 적용할 때
initial sync또는oplog sync단계 동안에만 표시됩니다.details.latestTimestampinitial sync단계에서 이는 초기 동기화 중에 초기 데이터가 복사된 후 사용할 수 있는 최신 oplog 항목의 BSON 타임스탬프 값을 나타냅니다.oplog sync단계에서는 소스 배포에서 사용할 수 있는 최신 oplog 항목의 BSON 타임스탬프 값을 나타냅니다.oplog 엔트리를 테일링하거나 적용할 때
initial sync또는oplog sync단계 동안에만 표시됩니다.details.lastWriteOnSourceTimestampThe BSON timestamp value of the most recent oplog entry that is not a no-op. No-op entries are generally system-level operations such as heartbearts that do not write or edit data in the database.
mongomirrorrefreshes this value every 10 seconds. Operations which write or edit data in the database may not be reported until the next refresh occurs.lastWriteOnSourceTimestamp필드는 마이그레이션 중에 전환하기 전에 소스 배포에서 새로운 쓰기가 발생하지 않음을 확인하는 데 유용합니다.errorMessageA string that describes any error encountered by
mongomirror.
--collStatsThreshold <num>버전 1.5.0의 새로운 기능
Maximum number of collections which may exist before collStats is disabled. Use
-1to always run collStats or0to never run collStats. Default:-1
예시
복제본 세트를 Atlas로 마이그레이션합니다(소스에서 인증 없음)
다음 예에서는 인증이 필요하지 않은 소스 복제본 세트에서 마이그레이션합니다.
mongomirror --host sourceRS/source-host1:27017,source-host2:27017 \ --destination myAtlasRS/atlas-host1:27017,atlas-host2:27017 \ --destinationUsername myAtlasUser \ --destinationPassword myAtlasPwd
인증이 필요하지 않은 소스 복제본 세트에서 마이그레이션하려면 다음 옵션을 사용하여 mongomirror을(를) 실행합니다.
--host<sourceReplSet/seed list of members>--destination<Atlas 클러스터>--destinationUsername<atlasUser>--destinationPassword<atlasPassword>
대상의 경우 다음 형식으로 복제본 세트 이름과 그 뒤에 노드의 시드 목록을 지정합니다.
<replicaSetName>/<host1>:<port1>,<host2>:<port2>,<host3>:<port3>,...
The specified user must have the Atlas admin role on Atlas.
복제본 세트 마이그레이션: 소스 복제본 세트가 SCRAM-SHA1 인증을 사용함
다음 예에서는 SCRAM-SHA1 인증을 사용하는 소스 복제본 세트를 Atlas로 마이그레이션합니다.
mongomirror --host sourceRS/source-host1:27017,source-host2:27017,source-host3:27017 \ --username mySourceUser \ --password mySourcePassword \ --authenticationDatabase admin \ --destination myAtlasRS/atlas-host1:27017,atlas-host2:27017 \ --destinationUsername myAtlasUser \ --destinationPassword atlasPassw0Rd
To migrate from a source replica set that uses SCRAM-SHA1 authentication, run mongomirror with the following options:
--host<sourceReplSet/seed list of members>--username<sourceUser>--password<sourcePassword>--authenticationDatabase<sourceDatabase>--destination<Atlas 클러스터>--destinationUsername<atlasUser>--destinationPassword<atlasPassword>
소스 복제본 세트 사용자는 소스 클러스터에 필요한 액세스 권한이 있어야 합니다. backup 역할은 적절한 권한을 제공합니다.
대상의 경우 다음 형식으로 복제본 세트 이름과 그 뒤에 노드의 시드 목록을 지정합니다.
<replicaSetName>/<replicaMember>,<replicaMember>,<replicaMember>,...
The specified user must have the Atlas admin on Atlas.
복제본 세트 마이그레이션: 소스 복제 세트에 X.509 클라이언트 인증 필요
다음 예에서는 X.509 인증을 사용하는 소스 복제본 세트에서 마이그레이션합니다.
mongomirror --host sourceRS/source-host1:27017,source-host2:27017,source-host3:27017 \ --username "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry" \ --authenticationDatabase '$external' \ --authenticationMechanism MONGODB-X509 \ --ssl \ --sslPEMKeyFile <path-to-my-client-certificate.pem> \ --sslCAFile <path-to-my-certificate-authority-certificate.pem> \ --destination myAtlasRS/atlas-host1:27017,atlas-host2:27017 \ --destinationUsername myAtlasUser \ --destinationPassword atlasPassw0Rd
To migrate from a source replica set that uses X.509 authentication, run mongomirror with the following options:
--host<sourceReplSet/seed list of members>--username<subject from the client certificate>--authenticationMechanismMONGODB-X509--authenticationDatabase'$external'--sslPEMKeyFile<path-to-my-client-certificate.pem>--sslCAFile<path to root CA PEM file>--destination<Atlas 클러스터>--destinationUsername<atlasUser>--destinationPassword<atlasPassword>
소스 복제본 세트 사용자는 소스 클러스터에 필요한 액세스 권한이 있어야 합니다. backup 역할은 적절한 권한을 제공합니다.
대상의 경우 다음 형식으로 복제본 세트 이름과 그 뒤에 노드의 시드 목록을 지정합니다.
<replicaSetName>/<replicaMember>,<replicaMember>,<replicaMember>,...
The specified user must have the Atlas admin on Atlas.
복제본 세트 마이그레이션: 소스 복제본 세트에 Kerberos/GSSAPI 인증 필요
다음 예에서는 Kerberos 인증을 사용하는 소스 복제본 세트에서 마이그레이션합니다.
mongomirror --host sourceRS/source-host1:27017,source-host2:27017,source-host3:27017 \ --username sourceUser/administrator@MYREALM.COM \ --authenticationDatabase '$external' \ --authenticationMechanism GSSAPI \ --destination myAtlasRS/atlas-host1:27017,atlas-host2:27017,atlas-host3:27017 \ --destinationUsername atlasUser \ --destinationPassword atlasPass
To migrate from a source replica set that uses Kerberos authentication, run mongomirror with the following options:
--host<sourceReplSet/seed list of members>--username<Kerberos user principal>--authenticationDatabase'$external'--authenticationMechanismGSSAPI--destination<Atlas 클러스터>--destinationUsername<atlasUser>--destinationPassword<atlasPassword>
소스 복제본 세트 사용자는 소스 클러스터에 필요한 액세스 권한이 있어야 합니다. backup 역할은 적절한 권한을 제공합니다.
대상의 경우 다음 형식으로 복제본 세트 이름과 그 뒤에 노드의 시드 목록을 지정합니다.
<replicaSetName>/<replicaMember>,<replicaMember>,<replicaMember>,...
The specified user must have the Atlas admin on Atlas.
mongomirror 출력을 파일에 저장
나중에 검사하고 디버깅하기 위해 mongomirror 절차의 출력 로그를 파일에 저장할 수 있습니다. 다음 형식을 사용하여 mongomirror.log 파일에 출력을 저장합니다.
mongomirror <args> 2>&1 | tee -a mongomirror.log