이 페이지에서는 MongoDB 데이터베이스에서 BigQuery 또는 Cloud Storage와 같은 지원되는 대상으로 데이터를 스트리밍하도록 변경 데이터 캡처 (CDC)를 구성하는 방법을 설명합니다. Atlas라는 완전 관리형 클라우드 데이터베이스 서비스에서 데이터를 복제하도록 Datastream을 구성하거나 자체 관리형 MongoDB 인스턴스에서 복제하는 경우 MongoDB Shell을 사용할 수 있습니다.
MongoDB Atlas 인스턴스 구성
MongoDB Atlas 인스턴스에서 Datastream을 사용하려면 먼저 Datastream 사용자를 만들고 데이터베이스 액세스 권한을 부여해야 합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-10(UTC)"],[],[],null,["# Configure a MongoDB database\n\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\n\u003cbr /\u003e\n\nThis page describes how to configure a MongoDB database for use with\nDatastream. You can configure Datastream to replicate\ndata from a fully managed cloud database service called Atlas, or, if you're\nreplicating from a self-managed MongoDB instance, using the MongoDB Shell.\n\nConfigure a MongoDB Atlas instance\n----------------------------------\n\n| **Note:** The steps that follow apply to both replica set and sharded clusters.\n\nTo use Datastream with a MongoDB Atlas instance, you first need\nto create a Datastream user and grant them database access:\n\n1. In the [MongoDB Atlas dashboard](https://www.mongodb.com/products/platform/cloud), under **Security** , click **Database access**.\n2. Click **New database user** and select the password authentication method for your user.\n3. Enter the username and password for your Datastream user.\n4. Select **Grant specific user privileges** under **Database user\n privileges**.\n5. Add these roles/privileges under **Specific privileges** :\n - `readAnyDatabase`\n6. Click **Add user**.\n\nConfigure a MongoDB self-hosted instance\n----------------------------------------\n\nThis page describes how to configure a MongoDB self-hosted database for use with\nDatastream for both replica set and sharded cluster.\n\n### Replica set\n\nFor information about deploying a MongoDB replica set, see\n[Deploy a self-managed replica set](https://www.mongodb.com/docs/manual/tutorial/deploy-replica-set/)\nin MongoDB documentation.\n\nTo configure Datastream for use with a self-managed MongoDB\nreplica set, follow these steps:\n\n1. Install the MongoDB Shell. For information about installing the MongoDB Shell, see the [MongoDB documentation](https://www.mongodb.com/docs/mongodb-shell/install/).\n2. Open the terminal and run the `mongosh` command to connect to your replica set or primary node.\n3. Create a user for Datastream in the `admin` database:\n\n use admin\n db.createUser({\n user: \"\u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e\",\n pwd: \"\u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e\",\n roles: [ \"readAnyDatabase\", {role: \"read\", db: \"admin\"} ]\n })\n\nReplace \u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e and \u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e with your username and password.\n\n### Sharded cluster\n\nFor information about deploying a sharded cluster, see\n[Deploy a sharded cluster](https://www.mongodb.com/docs/kubernetes-operator/current/tutorial/deploy-sharded-cluster/)\nin MongoDB documentation.\n\nTo configure Datastream for use with a self-managed MongoDB\nsharded cluster, follow these steps:\n\n1. Install the MongoDB Shell. For information about installing the MongoDB Shell, see the [MongoDB documentation](https://www.mongodb.com/docs/mongodb-shell/install/).\n2. Open the terminal and run the `mongosh` command to connect to your MongoDB sharded cluster.\n3. Create an identical Datastream user in every primary shard node and the `mongos` query router:\n\n use admin\n db.createUser({\n user: \"\u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e\",\n pwd: \"\u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e\",\n roles: [ \"readAnyDatabase\" ]\n })\n\nReplace \u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e and \u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e with your username and\npassword. You can pick any username and password, but it must be consistent\nacross all primary shard nodes and the mongos query router.\n\nTo find out which shards are connected to the mongos query router, run the\nfollowing command:\n\n`db.adminCommand({ listShards: 1 })`"]]