MongoShake
MongoShake copied to clipboard
MongoDB集群同步到MongoDB集群,启动mongoshake时报错
mongoshake版本:2.8.2 mongodb 源端版本:4.2.17 mongodb目标端版本:4.2.17
修改好配置文件后,启动mongoshake 报如下错误: [2023/05/10 17:11:18 CST] [CRIT] run replication failed: select sync mode failed: start time illegal, can't run incr sync
这个提示很明显,配置的时间不对,不能进行增量同步
这个提示很明显,配置的时间不对,不能进行增量同步 时间没有配置,是默认的呢。
我们演练的步骤如下:
- 从a 集群 通过mongoshake,同步模式 sync_mode= all 同步至 b集群 mongo_urls = mongodb://user_name:password@xxx:27017,xxx:27017,xxx:27017 tunnel.address = mongodb://user_name:password@yyy:27017
- a 集群和b 集群数据一致后,停止所有应用服务。停止mongoshake进程,配置反向(b集群同步至a集群)增量同步(修改 b集群同步至a集群 mongoshake 配置文件中目标端和源端地址及同步模式,sync_mode=incr)。 mongo_urls = mongodb://user_name:password@yyy:27017,yyy:27017,yyy:27017 tunnel.address = mongodb://user_name:password@xxx:27017 启动mongoshake 可以正常同步
- 再次切换,停止所有应用服务,停止mongoshake进程,修改配置文件(目标端和源端地址及同步模式,sync_mode=incr) a 集群同步至b 集群 mongo_urls = mongodb://user_name:password@xxx:27017,xxx:27017,xxx:27017 tunnel.address = mongodb://user_name:password@yyy:27017 此时启动mongoshake 时报错: run replication failed: select sync mode failed: start time illegal, can't run incr sync
注:在进行步骤3的时候,停止mongoshake进程后,有一个应用忘记停,导致有1分钟的数据写入b集群。
步骤3中运行mongoshake的时候,checkpoint.storage.collection对应的位点数据有清理吗? 如果还没有解决,请参考:https://github.com/alibaba/MongoShake/issues/700 提供下相关的信息
删除了表ckpt_default use mongoshake db.ckpt_default.drop();