创建角色及用户
use admin;
db.createRole(
{
role: "dbzrole",
privileges: [{
// 所有数据库中所有非系统集合的 grant 权限
resource: { db: "", collection: "" },
actions: [
"splitVector",
"listDatabases",
"listCollections",
"collStats",
"find",
"changeStream" ]
}],
roles: [
// 阅读 config.collections 和 config.chunks用于分片集群快照拆分。
{ role: 'read', db: 'config' },
// 读取local下oplog.rs
{ role: 'read', db: 'local' }
]
}
);
db.createUser(
{
user: 'dbzuser',
pwd: 'dbzpwd******',
roles: [
{ role: 'dbzrole', db: 'admin' }
]
}
);
连接器示例
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" localhost:8083/connectors/ -d '{"name": "one_form_conn1", "config": {"connector.class": "io.debezium.connector.mongodb.MongoDbConnector", "mongodb.hosts": "127.0.0.1:37001", "mongodb.user": "dbzuser", "mongodb.password": "dbzpwd******", "topic.prefix": "topic1", "database.include.list": "db1"}}'
参考链接
MongoDB CDC 连接器
Debezium connector for MongoDB - Setting up MongoDB