开发者社区> 问答> 正文

canal instance是自动从目标实例所拥有的binlog起点开始同步吗

假如我的配置是这样

canal.instance.master.address=ip:port canal.instance.master.journal.name= canal.instance.master.position= canal.instance.master.timestamp= canal.instance.master.gtid=

那么canal是从目标ip:port 获取最小的binlog pos开始同步吗. 还是从最新的位置呢?

也就是说canal是通过show binlog logs

show binary logs; +-----------------------------+------------+ | Log_name | File_size | +-----------------------------+------------+ | 0040273306-mysql-bin.002492 | 1073742339 | | 0040273306-mysql-bin.002493 | 1073742006 | | 0040273306-mysql-bin.002494 | 1073742056 | | 0040273306-mysql-bin.002495 | 1073767572 | | 0040273306-mysql-bin.002496 | 1073747118 |

找到最旧的位置, file=0040273306-mysql-bin.002492 pos=1 做为change master语句

还是说通过 show master status

fanboshi@192.168.4.27 16:32:24 [(none)]> show master status; +-----------------------------+------------+--------------+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +-----------------------------+------------+--------------+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ | 0040273306-mysql-bin.002682 | 1004220587 | | | 38f8425e-9182-5934-b32a-7e4317fe4a04:1-2687352400, 50bedb44-148f-ee18-6670-3c42d5878c6d:1-3102967082, a3a2c90e-328f-11e9-aece-20040fee8318:1-64510 | +-----------------------------+------------+--------------+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)

file=0040273306-mysql-bin.002682, pos=1004220587 作为change master语句呢

原提问者GitHub用户Fanduzi

展开
收起
古拉古拉 2023-05-08 12:34:34 74 0
1 条回答
写回答
取消 提交回答
  • show master status,最新的位置开始binlog获取

    原回答者GitHub用户agapple

    2023-05-09 17:38:25
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
PolarDB-X 2.0 全局 Binlog 与备份恢复能 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载