MongoDB 权限配置
更新时间: 2023-01-12 15:44:17
阅读 2260
CDC(Change Data Capture),即数据变更抓取,通过为源端数据源开启CDC,作业可实现数据源的实时数据同步。 本章节主要介绍如何为MongoDB数据库开启CDC功能。
前提条件
MongoDB 版本 >= 3.6
操作步骤
注意:建议由数据库管理员对数据源配置进行操作。 |
- Cluster Deployment
部署集群模式 replica sets or sharded clusters - Storage Engine
使用WiredTiger storage engine - Replica set protocol version
Replica set protocol version 1 (pv1) is required. Starting in version 4.0, MongoDB only supports pv1. pv1 is the default for all new replica sets created with MongoDB 3.2 or later. - Privileges
需要changeStream 和 read 权限
简单的授权案例,更多请参考MongoDB Database User Roles
use admin;
db.createUser({
user: "CDCuser",
pwd: "CDCpw",
roles: [
{ role: "read", db: "admin" }, //read role includes changeStream privilege
{ role: "readAnyDatabase", db: "admin" } //for snapshot reading
]
});
文档反馈
以上内容对您是否有帮助?