MongoDB 到 ClickHouse
| 功能 | 说明 |
|---|---|
Full Data Migration | Migrate data by sequentially scanning data in tables and writing it in batches to the target database. Supported _id types: ObjectId, Long, Integer. |
Incremental Data Sync | Sync of INSERT, UPDATE, DELETE is supported. |
Data Verification and Correction | Verify all existing data. Optionally, you can correct the inconsistent data based on verification results. Scheduled DataTasks are supported. |
Subscription Modification | Add, delete, or modify the subscribed tables with support for historical data migration. For more information, see Modify Subscription. |
Position Resetting | Reset positions by timestamp to consume the oplog in a past period again. |
Supported Deployment | Support master-slave, replica set, sharded cluster. |
Table Name Mapping | Support the mapping rules, namely, keeping the name the same as that in Source, converting the text to lowercase, converting the text to uppercase, truncating the name by "_digit" suffix. |
高级功能
| 功能 | 说明 |
|---|---|
追加模式写入 | INSERT 和 UPDATE 以追加模式批量写入, DELETE 单独通过 ALTER 方式执行 |
定时优化表 | 通过设置 autoOptimizeThresholdSec 参数,定时优化表 |
Custom Code | For more information, see Custom Code Processing, Debug Custom Code and Logging in Custom Code. |
Adding Virtual Columns | Support adding custom virtual columns with fixed values, such as region, ID, etc. |
限制和注意点
| 限制项 | 说明 |
|---|---|
oplog 大小和保留时间设置 | MongoDB 默认配置 replication.oplogSizeMB 过小 或 storage.oplogMinRetentionHours 过小,如数据同步延迟过大,可能导致未消费的 oplog 被清除,需调大此参数 |
MongoDB 主备架构的任务设置 | 源端 MongoDB 主备架构模式,需要将源端任务参数 oplogCollection 设置为 oplog.$main |
changeStream 模式 | MongoDB 3.6 以上支持 changeStream 获取增量变更,同步任务可以设置源端参数 captureMode 为 CHANGE_STREAM,MongoDB 分片集群可以填写 Mongos 连接串进行同步 |
oplog 模式 | 当使用 oplog 模式进行 MongoDB 源端同步时,需要确保该能够访问到 local 库 |
特殊操作 | DELETE 操作过多(>50 条/秒)将大幅影响数据同步性能 |
目标端表引擎 | 仅支持以下表引擎以及对应的源端表类型:
|
任务参数
| 参数名称 | 说明 |
|---|---|
captureMode | 配置 MongoDB 增量源端模式,支持 OP_LOG 和 CHANGE_STREAM 模式 |
changeStreamBatchSize | 配置 MongoDB Change Stream 每一 批拉取变更事件的最大条数 |
oplogCollection | 配置 MongoDB oplog 的集合名,默认是 oplog.rs |
timezone | 需要转换的源端时区(默认 UTC) |
Tips: 通用参数配置请参考 通用参数及功能
任务参数
| 参数名称 | 说明 |
|---|---|
multiReplica | 是否为多副本集群 |
clusterName | 集群名称,当 multiReplica 为 true, 则自动在 DDL/DML 中加入 ON CLUSTER clusterName 子句 |
ckTableEngine | 当前支持以下表引擎:
|
autoOptimizeThresholdSec | 定时优化表(optimize table final)间隔,<=0 则关闭此功能 |
enableTimeRangeClamping | 是否启用时间范围裁剪,强制将时间和日期值收束到 ClickHouse JDBC 的合法区间内,超出的数值将被截断至最小值或最大值。默认关闭(false)。 收束后范围(UTC):
|
Tips: 通用参数配置请参考 通用参数及功能