canal同步mysql数据到MQ如何做到MySQL层批量更新某字段1000条数据,然后完全按照binlog的顺序存放到mq的消息队列中
样例:mysql update 字段数据 update t_admin_login_log set cdate = '2021-06-05 00:00:00' where id < 1000;
mq topic对应的json格式数据 { "data": [ { "cdate": "2021-06-05 00:00:01", "login_time": "2020-09-07 17:19:47", "admin_id": "1355", "id": "11", "admin_name": "于家祺", "login_addr": "", "udate": "2020-09-07 17:19:47", "login_ip": "114.242.249.124", "status": "1" }, { "cdate": "2021-06-05 00:00:01", "login_time": "2020-09-07 17:19:47", "admin_id": "1535", "id": "22", "admin_name": "周虎", "login_addr": "", "udate": "2020-09-07 17:19:47", "login_ip": "114.242.247.124", "status": "1" }, { "cdate": "2021-06-05 00:00:01", "login_time": "2020-09-07 20:25:09", "admin_id": "12443", "id": "33", "admin_name": "冯德平", "login_addr": "", "udate": "2020-09-07 20:25:09", "login_ip": "222.128.15.250", "status": "1" }, { "cdate": "2021-06-05 00:00:01", "login_time": "2020-09-08 15:51:15", "admin_id": "12452", "id": "44", "admin_name": "范雪成", "login_addr": "", "udate": "2020-09-08 15:51:15", "login_ip": "222.128.15.250", "status": "1" }, { "cdate": "2021-06-05 00:00:01", "login_time": "2020-09-09 10:51:57", "admin_id": "12725", "id": "55", "admin_name": "蔡雪奎", "login_addr": "", "udate": "2020-09-09 10:51:57", "login_ip": "222.128.15.250", "status": "1" }, { "cdate": "2021-06-05 00:00:01", "login_time": "2020-09-10 16:15:11", "admin_id": "12710", "id": "66", "admin_name": "张晓林", "login_addr": "", "udate": "2020-09-10 16:15:11", "login_ip": "222.128.15.250", "status": "1" }, { "cdate": "2021-06-05 00:00:01", "login_time": "2020-09-10 16:48:22", "admin_id": "12624", "id": "77", "admin_name": "吴佳辉", "login_addr": "", "udate": "2020-09-10 16:48:22", "login_ip": "27.19.194.45", "status": "1" } ], "pkNames": [ "id" ], "old": [ {}, { "cdate": "2021-06-05 00:00:00" }, {}, { "cdate": "2021-06-05 00:00:00" }, { "cdate": "2021-06-05 00:00:00" }, { "cdate": "2021-06-05 00:00:00" }, { "cdate": "2021-06-05 00:00:00" } ], "type": "UPDATE", "es": 1637225320000, "sql": "", "database": "db_admin", "sqlType": { "cdate": 93, "login_time": 93, "admin_id": 4, "logout_time": 93, "id": 4, "admin_name": 12, "login_addr": 12, "udate": 93, "login_ip": 12, "status": -6 }, "mysqlType": { "cdate": "datetime", "login_time": "datetime", "admin_id": "int(10)", "logout_time": "datetime", "id": "int(11)", "admin_name": "varchar(16)", "login_addr": "varchar(64)", "udate": "datetime", "login_ip": "varchar(32)", "status": "tinyint(4)" }, "id": 12, "isDdl": false, "table": "t_admin_login_log", "ts": 1637225320944 }
想要的结果是:一个修该后的数据对应一个old值。 canal是否提供这样的参数来控制实现 { "cdate": "2021-06-05 00:00:01", "login_time": "2020-09-07 17:19:47", "admin_id": "1355", "id": "11", "admin_name": "于家祺", "login_addr": "", "udate": "2020-09-07 17:19:47", "login_ip": "114.242.249.124", "status": "1" },
"old": [ {}, { "cdate": "2021-06-05 00:00:00" },
原提问者GitHub用户wujianwei11
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。