mongosync 유틸리티는 MongoDB 클러스터 간에 연결을 생성합니다. mongosync 는 다음 클러스터 중 하나에 연결할 수 있습니다.
MongoDB Atlas 호스팅 클러스터
자체 관리형 클러스터 및 Atlas 호스팅 클러스터
이 페이지에서는 MongoDB Mongosync를 사용하여 Atlas 클러스터를 연결하는 방법에 대해 설명합니다. Atlas cluster 연결에 대한 자세한 내용은 데이터베이스 배포에 연결을 참조하세요.
고려 사항
소스 및 대상 Atlas 클러스터는 모두 MongoDB 6.0 이상을 사용해야 합니다.
mongosync복제본 세트와 샤딩된 클러스터를 지원합니다.mongosyncAtlas 공유 클러스터 또는 서버리스 인스턴스를 지원 하지 않습니다 .mongosync는 M10 이상의 Atlas 클러스터에서만 사용할 수 있습니다.중요
Latest Version With Auto Upgrades을(를) 선택하지 마세요. 이 옵션은 클러스터 를 최신 마이너 출시하다 로 자동 업그레이드합니다. MongoDB 버전 8.2과 같은 일부 마이너 릴리스는 실시간 마이그레이션 또는 Mongosync를 지원 하지 않을 수 있습니다. 업그레이드할 때 실시간 마이그레이션 및 Mongosync와의 호환성을 보장하기 위해 주요 버전을 선택합니다.
연결 문자열
mongosync MongoDB URI 연결 string 을 사용하여 Atlas 클러스터를 연결합니다.
SRV 연결 체계의 형식은 다음과 같습니다.
mongodb+srv://[username:password]@[clusterName].[host].mongodb.net/ 에서 SRV 연결 을 찾는 방법에 대한 자세한 string Atlas 내용은 클러스터에 연결을 참조하세요.
표준 URI 연결 체계의 형식은 다음과 같습니다.
mongodb://[username:password]@[clusterName].[host].mongodb.net/
mongosync primary 소스 및 대상 클러스터에 연결하려면 읽기 설정 (read preference) 필요합니다. 자세한 내용은 읽기 기본 설정 옵션을 참조하세요.
인증
유효한 인증 을 제공하여 MongoDB Atlas 클러스터 에 연결합니다. 아직 Atlas 데이터베이스 사용자가 없는 경우 사용자를 만들어야 합니다.
역할
mongosync 연결 문자열 에 지정된 사용자에게는 소스 및 대상 클러스터에 대한 필수 권한이 있어야 합니다. 권한은 환경과 역 동기화 사용 여부에 따라 달라집니다.
Atlas 권한은 다음과 같습니다.
동기화 유형 | 필수 소스 권한 | 필수 대상 권한 |
|---|---|---|
기본값 |
|
|
반전 또는 다중 반전 |
|
|
Atlas 역할에 대한 자세한 내용은 Atlas User Role을 참조하세요.
Atlas user 권한을 업데이트 하려면 프로젝트에 대한 액세스 관리를 참조하세요.
행동
호스팅
The mongosync utility can be hosted on its own hardware close to either the source or destination cluster. It does not have to be hosted on the same server as one of the mongod or mongos instances in the cluster. This flexibility allows you to push, or pull, data to the destination cluster with minimal impact on the mongod or mongos instances running there.
초기 상태
mongosync 가 연결되면 IDLE 상태가 됩니다. 동기화를 시작하려면 시작 명령을 실행해야 합니다.
제한 사항
Atlas cluster 로 를 실행 하기 전에 mongosync M10+ Require Indexes for All Queries 옵션을 notablescan false 비활성화하여 소스 클러스터와 대상 클러스터 모두에서 을(를)(으)로 설정하다 .
예시
연결 정보 수집
일반 연결 문자열 형식은 다음과 같습니다.
mongodb://<user>:<password>@<clusterName>.<hostname>.mongodb.net/
Atlas UI 에서 Atlas cluster에 대한 연결 문자열 가져올 수 있습니다. 자세한 학습 은 데이터베이스 배포에 연결을 참조하세요.
cluster0 및 cluster1 에 대해 수집한 연결 문자열은 다음과 유사해야 합니다.
cluster0: mongodb+srv://clusterAdmin:superSecret@cluster1Name.abc123.mongodb.net cluster1: mongodb+srv://clusterAdmin:superSecret@cluster2Name.abc123.mongodb.net
클러스터가 포함된 프로젝트 에 비밀번호가 superSecret 인 데이터베이스 관리 사용자 clusterAdmin 가 있습니다.
소스 및 대상 cluster 연결 mongosync
아래의 mongosync 명령 레이아웃은 표시되도록 수정되었습니다. mongosync 을 사용하여 cluster0 를 cluster1 에 연결하려면 다음 명령을 한 줄에 입력합니다.
mongosync \ --cluster0 "mongodb+srv://clusterAdmin:superSecret@cluster1Name.abc123.mongodb.net" \ --cluster1 "mongodb+srv://clusterAdmin:superSecret@cluster2Name.abc123.mongodb.net"
Atlas 클러스터에는 TLS 연결이 필요합니다.mongosync Atlas 클러스터에서 를 tls=true 사용하려면 옵션을 추가합니다. 예시 admin cluster0 들어 및 cluster1 에서 데이터베이스 에 연결하려면 다음을 수행합니다.
mongosync \ --cluster0 "mongodb+srv://clusterAdmin:superSecret@cluster1Name.abc123.mongodb.net/admin?tls=true" \ --cluster1 "mongodb+srv://clusterAdmin:superSecret@cluster2Name.abc123.mongodb.net/admin?tls=true"
와 함께 연결 문자열을 사용할 수도 mongodb+srv mongosync 있습니다. 연결 문자열 에 옵션을 추가할 필요가 tls=true mongodb+srv 없습니다. 예시 들면 다음과 같습니다.
mongosync \ --cluster0 "mongodb+srv://clusterAdmin:superSecret@cluster1Name.abc123.mongodb.net/" \ --cluster1 "mongodb+srv://clusterAdmin:superSecret@cluster2Name.abc123.mongodb.net/"
mongodb+srv 연결 문자열에 대한 자세한 내용은 SRV 연결 형식을 참조하세요.