# Create an instance-level read-only accountuse admindb.createUser({user: "username",pwd: "password",roles:[{role: "readAnyDatabase",db: "admin"}]})# Create a database-specific read-only accountuse admindb.createUser({user: "username",pwd: "password",roles:[{role: "read",db: "Name of the specified database"}]})
Operation Type | Supported SQL Operations |
DML | INSERT, UPDATE, DELETE |
DDL | INDEX: createIndexes, createIndex, dropIndex, dropIndexes; COLLECTION: createCollection, drop, collMod, renameCollection; DATABASE: dropDatabase, copyDatabase |
Parameter | Description | Configuration Method |
Service Type | Select the service type. This document describes the Data Subscription service. | Select Data Subscription. |
Billing Mode | ||
Region | Select the region where the subscription service resides. | It must be the same as that of the database instance to be subscribed to. |
Database | Select the type of the database for the data subscription service. | Select MongoDB. |
Version | Data can be directly consumed through the Kafka client. | Select Kafka Edition. |
Tag | Specify the tag for the data subscription service. | Click Add and select Tag Key and Tag Value in the drop-down list. |
Subscribed Instance Name | Specify how to name the data subscription service. | Name after Creation: Set the name after the data subscription service is created, which is name-subscription ID by default. The subscription ID is randomly assigned by the system. Name Now: Enter the name of the data subscription service directly in the input box below. |
Quantity | Select the number of tasks to be purchased. | You can purchase up to 10 tasks at a time. |
Parameter | Description | Configuration Method |
Subscription ID / Name | ID and name of the subscription task. The task name is name-subscription ID by default. | Confirm the ID and name of the data subscription task. |
Instance Type | It is MongoDB by default. | - |
Region | The region where the subscription service resides. | Confirm the region. |
Access Type | Select the type of source database access to the data subscription service. | Currently, only Database is supported, i.e., a TencentDB instance. |
Instance Name | Select the specific MongoDB instance for the data subscription service. | Select a specific instance ID in the drop-down list. |
Account | Set the access account information of the MongoDB instance. | Enter the prepared read-only account information in the input box. |
Password | Set the password of the access account of the MongoDB instance. | Enter the password of the read-only account in the input box. Password-free access is not supported. |
Kafka Partition Count | Select the number of Kafka partitions for the data subscription task. In Kafka, a consumer can get data by subscribing to one or more topics and then consuming data from one or more partitions of each topic. | You can select 1, 4, or 8. A single partition can guarantee the order of messages, while multiple partitions cannot. If you have strict requirements for the order of messages during consumption, set this value to 1. Increasing the number of partitions can improve the throughput and parallelism of the Kafka cluster, because multiple consumers can consume different partitions at the same time. However, doing so will also increase the management and maintenance costs of the Kafka cluster and may cause data imbalance or delays. |
Test Connectivity | Test the connectivity between the data subscription service and the TencentDB for MongoDB instance. | Click Test Connectivity and wait for the test result. If the test fails, troubleshoot as prompted. Then, click Test Again to test the connectivity again. After the test passes, proceed to the next step. |
Parameter | Description | Configuration Method |
Subscription ID / Name | ID and name of the subscription task. | Check whether the subscription task information is correct. |
Subscribed Instance | Instance ID of the subscribed MongoDB database. | Check whether the instance information is correct. |
Data Subscription Type | The type of data that the subscriber can choose to subscribe to. MongoDB uses the change stream feature to monitor data changes and implement data subscription. | It is Change Stream by default and cannot be modified. |
Subscription Object Level | Level of the subscribed data, including Full instance, Database, and Collection. Full instance: Subscribe to the data in the entire instance. Database: Subscribe to the data in the specified database. After selecting this option, you can select only one database in Task Configuration. Collection: Subscribe to the data in the specified collection. After selecting this option, you can select only one collection in Task Configuration. | Select the level of data subscription as needed. System databases admin , local , and config cannot be selected. |
Task Configuration | When Subscription Level is Database or Collection, this parameter will be displayed for you to specify the database or collection. | In the Select databases and tables section, select the database or collection to be subscribed. In the Selected section, check whether the selected database or collection is correct. |
Output Aggregation Settings | This parameter configures whether to enable aggregation for the subscribed data before sending it to the subscriber. | Enable: Click to enable aggregation. Click Add, select an operator in the Aggregation Operator drop-down list, and enter an expression in the Aggregation Expression input box.Click Add to add multiple aggregation expressions. The aggregation pipeline will be executed based on the order of added aggregation operations. For more information, see Modify Change Stream Output. |
Kafka Partitioning Policy | If Kafka Partition Count is not 1 in the previous step, you need to set the partition policy. By Collection Name: Partitions the subscribed data from the source database by collection name. With this policy, data with the same collection name is written to the same Kafka partition. Custom Partitioning Policy: Database and collection names of the subscribed data are matched through a regex first. Then, matched data is partitioned by collection name or collection name + objectid . | Select Custom Partitioning Policy, click Add in Custom Partitioning Policy below, set the matching mode of database name or collection name in the form of regular expression in the Database Name Match or Table Name Match input box below, and select By Collection Name or By Collection Name + ObjectId in the Partitioning Policy drop-down list. When you enable the custom partitioning policy option, your custom partitioning policies will be applied first, followed by the Kafka partitioning policies. The data in a collection that cannot be partitioned using the custom partitioning policies will be routed to Kafka partitions by default policy By Collection Name. |
Custom Partitioning Policy
| This parameter will be displayed if Custom Partitioning Policy is selected in Kafka Partitioning Policy. It sets the custom partitioning policy. | |
Policy Combo Result | This parameter will be displayed if Custom Partitioning Policy is selected in Kafka Partitioning Policy. It indicates the combo result of the custom partitioning policy. | |
Was this page helpful?