1.8.1부터 시작, Atlas Workload Identity Federation과 함께 mongosync 를 사용하여 Microsoft Azure 및 Google Cloud Platform 에서 실행 되는 MongoDB 클러스터에 대한 연결을 인증할 수 있습니다.
예시
이 섹션의 예시에서는 워크로드 인증 페데레이션과 함께 mongosync 을 사용합니다.
In the connection string, set authMechanism to MONGODB-OIDC and set authMechanismProperties as needed:
Microsoft Azure의 경우
authMechanismProperties을ENVIRONMENT:azure,TOKEN_RESOURCE:<audience>(으)로 설정합니다.TOKEN_RESOURCE를 생략합니다. Microsoft Azure Kubernetes Service(AKS)를 사용하는 경우Google Cloud Platform 의 경우
authMechanismProperties을ENVIRONMENT:gcp,TOKEN_RESOURCE:<audience>로 설정하다 합니다.
Replace <audience> with the application or service that the access token is intended for. For details, see Identity Provider Fields.
연결 문자열 string 옵션에 대한 자세한 내용은 인증 옵션을 참조하세요.
Microsoft Azure 인스턴스 메타데이터 서비스를 사용하여 MongoDB 클러스터에 연결
다음 mongosync 예시 는 Microsoft Azure 인스턴스 메타데이터 서비스(IMDS)를 사용하여 MongoDB 클러스터에 연결합니다.
./bin/mongosync \ --logPath /var/log/mongosync \ --cluster0 "mongodb://clusterOne01.fancyCorp.com:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure,TOKEN_RESOURCE:https://www.example.com" \ --cluster1 "mongodb://clusterTwo01.fancyCorp.com:20020,clusterTwo02.fancyCorp.com:20020,clusterTwo03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure,TOKEN_RESOURCE:https://www.example.com"
Microsoft Azure Kubernetes 서비스를 사용하여 MongoDB 클러스터에 연결
Microsoft Azure Kubernetes Service를 사용하여 MongoDB cluster에 연결하려면 다음 환경 변수를 정의하세요.
환경 변수 | 설명 |
|---|---|
| Azure tenant identifier. |
| Azure 애플리케이션 클라이언트 식별자입니다. |
| 인증할 managed ID의 Azure 클라이언트 식별자입니다. |
| Azure 연합 토큰 파일 경로입니다. |
Azure 및 변수에 대한 자세한 내용은 Microsoft Azure 설명서를 참조하세요.
다음 mongosync 예시 환경 변수를 정의하고 MongoDB 클러스터에 연결합니다.
AZURE_TENANT_ID=08206ab8-16a0-406d-85e4-2f15f5620fac \ AZURE_APP_CLIENT_ID=b6c835da-e536-425b-9405-64bc471e245b \ AZURE_CLIENT_ID=f176d4eb-7dcd-4f66-bccf-aaa316ee61fd \ AZURE_FEDERATED_TOKEN_FILE=/var/run/secrets/azure/tokens/azure-identity-token \ ./bin/mongosync \ --logPath /var/log/mongosync \ --cluster0 "mongodb://clusterOne01.fancyCorp.com:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure" \ --cluster1 "mongodb://clusterTwo01.fancyCorp.com:20020,clusterTwo02.fancyCorp.com:20020,clusterTwo03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure"
이 예시에는 TOKEN_RESOURCE 가 필요하지 않습니다.
Google Cloud Platform 에서 MongoDB 클러스터에 연결
다음 mongosync 예시 는 Google Cloud Platform 에서 MongoDB 클러스터에 연결합니다.
./bin/mongosync \ --logPath /var/log/mongosync \ --cluster0 "mongodb://clusterOne01.fancyCorp.com:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:gcp,TOKEN_RESOURCE:https://www.example.com" \ --cluster1 "mongodb://clusterTwo01.fancyCorp.com:20020,clusterTwo02.fancyCorp.com:20020,clusterTwo03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:gcp,TOKEN_RESOURCE:https://www.example.com"
Google Cloud Platform에는 특정 환경 변수가 필요하지 않습니다.