{"id":309,"date":"2023-05-27T20:16:27","date_gmt":"2023-05-27T12:16:27","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=309"},"modified":"2024-01-10T14:38:26","modified_gmt":"2024-01-10T06:38:26","slug":"7a0a88e2d5","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring\/7a0a88e2d5\/","title":{"rendered":"SpringBoot\u6574\u5408Canal+RabbitMQ\u76d1\u542c\u6570\u636e\u53d8\u66f4~"},"content":{"rendered":"<section style=\"font-size: 16px; color: black; padding-right: 10px; padding-left: 10px; line-height: 1.6; letter-spacing: 0px; word-break: break-word; text-align: left; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;\" data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\" data-mpa-powered-by=\"yiban.io\">\n<h2 style=\"font-weight: bold; font-size: 22px; color: #009688; padding-left: 10px; margin: 1em auto; border-left: 3px solid #009688;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u9700\u6c42<\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6211\u60f3\u8981\u5728SpringBoot\u4e2d\u91c7\u7528\u4e00\u79cd\u4e0e\u4e1a\u52a1\u4ee3\u7801\u89e3\u8026\u5408\u7684\u65b9\u5f0f\uff0c\u6765\u5b9e\u73b0\u6570\u636e\u7684\u53d8\u66f4\u8bb0\u5f55\uff0c\u8bb0\u5f55\u7684\u5185\u5bb9\u662f\u65b0\u6570\u636e\uff0c\u5982\u679c\u662f\u66f4\u65b0\u64cd\u4f5c\u8fd8\u5f97\u6709\u65e7\u6570\u636e\u5185\u5bb9\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u7ecf\u8fc7\u8c03\u7814\u53d1\u73b0\uff0c\u4f7f\u7528Canal\u6765\u76d1\u542cMySQL\u7684binlog\u53d8\u5316\u53ef\u4ee5\u5b9e\u73b0\u8fd9\u4e2a\u9700\u6c42\uff0c\u53ef\u662f\u5728\u76d1\u542c\u5230\u53d8\u5316\u540e\u9700\u8981\u9a6c\u4e0a\u4fdd\u5b58\u53d8\u66f4\u8bb0\u5f55\uff0c\u9664\u975e\u518d\u505a\u4e00\u4e9b\u903b\u8f91\u5904\u7406\uff0c\u4e8e\u662f\u6211\u53c8\u7ed3\u5408\u4e86RabbitMQ\u6765\u5904\u7406\u4fdd\u5b58\u53d8\u66f4\u8bb0\u5f55\u7684\u64cd\u4f5c\u3002<\/p>\n<h2 style=\"font-weight: bold; font-size: 22px; color: #009688; padding-left: 10px; margin: 1em auto; border-left: 3px solid #009688;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6b65\u9aa4<\/h2>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u542f\u52a8MySQL\u73af\u5883\uff0c\u5e76\u5f00\u542fbinlog<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u542f\u52a8Canal\u73af\u5883\uff0c\u4e3a\u5176\u521b\u5efa\u4e00\u4e2aMySQL\u8d26\u53f7\uff0c\u7136\u540e\u4ee5Slave\u7684\u5f62\u5f0f\u8fde\u63a5MySQL<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">Canal\u670d\u52a1\u6a21\u5f0f\u8bbe\u4e3aTCP\uff0c\u7528Java\u7f16\u5199\u5ba2\u6237\u7aef\u4ee3\u7801\uff0c\u76d1\u542cMySQL\u7684binlog\u4fee\u6539<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">Canal\u670d\u52a1\u6a21\u5f0f\u8bbe\u4e3aRabbitMQ\uff0c\u542f\u52a8RabbitMQ\u73af\u5883\uff0c\u914d\u7f6eCanal\u548cRabbitMQ\u7684\u8fde\u63a5\uff0c\u7528\u6d88\u606f\u961f\u5217\u53bb\u63a5\u6536binlog\u4fee\u6539\u4e8b\u4ef6<\/section>\n<\/li>\n<\/ul>\n<h2 style=\"font-weight: bold; font-size: 22px; color: #009688; padding-left: 10px; margin: 1em auto; border-left: 3px solid #009688;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u73af\u5883\u642d\u5efa<\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u73af\u5883\u642d\u5efa\u57fa\u4e8edocker-compose\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\">version:\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"3\"<\/span>\u00a0\u00a0\nservices:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0mysql:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0network_mode:\u00a0mynetwork\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0container_name:\u00a0mymysql\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ports:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0<span style=\"color: #d19a66; line-height: 26px;\">3306<\/span>:<span style=\"color: #d19a66; line-height: 26px;\">3306<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0restart:\u00a0always\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0volumes:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0\/etc\/localtime:\/etc\/localtime\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0\/home\/mycontainers\/mymysql\/data:\/data\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0\/home\/mycontainers\/mymysql\/mysql:\/var\/lib\/mysql\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0\/home\/mycontainers\/mymysql\/conf:\/etc\/mysql\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0environment:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0MYSQL_ROOT_PASSWORD=root\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0command:\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--character-set-server=utf8mb4\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--collation-server=utf8mb4_unicode_ci\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--log-bin=\/var\/lib\/mysql\/mysql-bin\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--server-id=<span style=\"color: #d19a66; line-height: 26px;\">1<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--binlog-format=ROW\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--expire_logs_days=<span style=\"color: #d19a66; line-height: 26px;\">7<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--max_binlog_size=<span style=\"color: #d19a66; line-height: 26px;\">500<\/span>M\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0image:\u00a0mysql:<span style=\"color: #d19a66; line-height: 26px;\">5.7<\/span>.<span style=\"color: #d19a66; line-height: 26px;\">20<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0rabbitmq:\u00a0\u00a0\u00a0\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0container_name:\u00a0myrabbit\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ports:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0<span style=\"color: #d19a66; line-height: 26px;\">15672<\/span>:<span style=\"color: #d19a66; line-height: 26px;\">15672<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0<span style=\"color: #d19a66; line-height: 26px;\">5672<\/span>:<span style=\"color: #d19a66; line-height: 26px;\">5672<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0restart:\u00a0always\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0volumes:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0\/etc\/localtime:\/etc\/localtime\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0\/home\/mycontainers\/myrabbit\/rabbitmq:\/var\/lib\/rabbitmq\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0network_mode:\u00a0mynetwork\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0environment:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0RABBITMQ_DEFAULT_USER=admin\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0RABBITMQ_DEFAULT_PASS=<span style=\"color: #d19a66; line-height: 26px;\">123456<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0image:\u00a0rabbitmq:<span style=\"color: #d19a66; line-height: 26px;\">3.8<\/span>-management\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0canal-server:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0container_name:\u00a0canal-server\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0restart:\u00a0always\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ports:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0<span style=\"color: #d19a66; line-height: 26px;\">11110<\/span>:<span style=\"color: #d19a66; line-height: 26px;\">11110<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0<span style=\"color: #d19a66; line-height: 26px;\">11111<\/span>:<span style=\"color: #d19a66; line-height: 26px;\">11111<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0<span style=\"color: #d19a66; line-height: 26px;\">11112<\/span>:<span style=\"color: #d19a66; line-height: 26px;\">11112<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0volumes:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0\/home\/mycontainers\/canal-server\/conf\/canal.properties:\/home\/admin\/canal-server\/conf\/canal.properties\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0\/home\/mycontainers\/canal-server\/conf\/instance.properties:\/home\/admin\/canal-server\/conf\/example\/instance.properties\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0\/home\/mycontainers\/canal-server\/logs:\/home\/admin\/canal-server\/logs\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0network_mode:\u00a0mynetwork\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0depends_on:\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0mysql\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-\u00a0rabbitmq\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0-\u00a0canal-admin\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0image:\u00a0canal\/canal-server:v1.<span style=\"color: #d19a66; line-height: 26px;\">1.5<\/span>\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6211\u4eec\u9700\u8981\u4fee\u6539\u4e0bCanal\u73af\u5883\u7684\u914d\u7f6e\u6587\u4ef6\uff1a<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">canal.properties<\/code>\u548c<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">instance.properties<\/code>\uff0c\u6620\u5c04Canal\u4e2d\u7684\u4ee5\u4e0b\u4e24\u4e2a\u8def\u5f84\uff1a<\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">\/home\/admin\/canal-server\/conf\/canal.properties<\/code><\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">canal.destinations<\/code>\u610f\u601d\u662fserver\u4e0a\u90e8\u7f72\u7684instance\u5217\u8868\uff0c<\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">\/home\/admin\/canal-server\/conf\/example\/instance.properties<\/code><\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u8fd9\u91cc\u7684\/example\u662f\u6307instance\u5373\u5b9e\u4f8b\u540d\uff0c\u8981\u548c\u4e0a\u9762<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">canal.properties<\/code>\u5185instance\u914d\u7f6e\u5bf9\u5e94\uff0ccanal\u4f1a\u4e3a\u5b9e\u4f8b\u521b\u5efa\u5bf9\u5e94\u7684\u6587\u4ef6\u5939\uff0c\u4e00\u4e2aClient\u5bf9\u5e94\u4e00\u4e2a\u5b9e\u4f8b<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4ee5\u4e0b\u662f\u6211\u4eec\u9700\u8981\u51c6\u5907\u7684\u4e24\u4e2a\u914d\u7f6e\u6587\u4ef6\u5177\u4f53\u5185\u5bb9\uff1a<\/p>\n<h4 style=\"font-weight: bold; margin: 0.6em auto; font-size: 1.2em; padding-left: 10px; border-left: 2px dashed #009688;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">canal.properties<\/h4>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#################################################\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#########\u00a0\u00a0\u00a0\u00a0\u00a0common\u00a0argument\u00a0\u00a0\u00a0#############\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#################################################\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0tcp\u00a0bind\u00a0ip\u00a0\u00a0<\/span>\ncanal.ip\u00a0=\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0register\u00a0ip\u00a0to\u00a0zookeeper\u00a0\u00a0<\/span>\ncanal.register.ip\u00a0=\u00a0\u00a0\ncanal.port\u00a0=\u00a011111\u00a0\u00a0\ncanal.metrics.pull.port\u00a0=\u00a011112\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal\u00a0instance\u00a0user\/passwd\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal.user\u00a0=\u00a0canal\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal.passwd\u00a0=\u00a0E3619321C1A937C46A0D8BD1DAC39F93B27D4458\u00a0\u00a0<\/span>\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal\u00a0admin\u00a0config\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal.admin.manager\u00a0=\u00a0canal-admin:8089\u00a0\u00a0<\/span>\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal.admin.port\u00a0=\u00a011110\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal.admin.user\u00a0=\u00a0admin\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal.admin.passwd\u00a0=\u00a06BB4837EB74329105EE4568DDA7DC67ED2CA2AD9\u00a0\u00a0<\/span>\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0admin\u00a0auto\u00a0register\u00a0\u81ea\u52a8\u6ce8\u518c\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal.admin.register.auto\u00a0=\u00a0true\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u96c6\u7fa4\u540d\uff0c\u5355\u673a\u5219\u4e0d\u5199\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal.admin.register.cluster\u00a0=\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0Canal\u00a0Server\u00a0\u540d\u5b57\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0canal.admin.register.name\u00a0=\u00a0canal-admin\u00a0\u00a0<\/span>\n\u00a0\u00a0\ncanal.zkServers\u00a0=\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0flush\u00a0data\u00a0to\u00a0zk\u00a0\u00a0<\/span>\ncanal.zookeeper.flush.period\u00a0=\u00a01000\u00a0\u00a0\ncanal.withoutNetty\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0tcp,\u00a0kafka,\u00a0rocketMQ,\u00a0rabbitMQ,\u00a0pulsarMQ\u00a0\u00a0<\/span>\ncanal.serverMode\u00a0=\u00a0tcp\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0flush\u00a0meta\u00a0cursor\/parse\u00a0position\u00a0to\u00a0file\u00a0\u00a0<\/span>\ncanal.file.data.dir\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">${canal.conf.dir}<\/span>\u00a0\u00a0\ncanal.file.flush.period\u00a0=\u00a01000\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##\u00a0memory\u00a0store\u00a0RingBuffer\u00a0size,\u00a0should\u00a0be\u00a0Math.pow(2,n)\u00a0\u00a0<\/span>\ncanal.instance.memory.buffer.size\u00a0=\u00a016384\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##\u00a0memory\u00a0store\u00a0RingBuffer\u00a0used\u00a0memory\u00a0unit\u00a0size\u00a0,\u00a0default\u00a01kb\u00a0\u00a0<\/span>\ncanal.instance.memory.buffer.memunit\u00a0=\u00a01024\u00a0\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##\u00a0meory\u00a0store\u00a0gets\u00a0mode\u00a0used\u00a0MEMSIZE\u00a0or\u00a0ITEMSIZE\u00a0\u00a0<\/span>\ncanal.instance.memory.batch.mode\u00a0=\u00a0MEMSIZE\u00a0\u00a0\ncanal.instance.memory.rawEntry\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">true<\/span>\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##\u00a0detecing\u00a0config\u00a0\u00a0<\/span>\ncanal.instance.detecting.enable\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.detecting.sql\u00a0=\u00a0insert\u00a0into\u00a0retl.xdual\u00a0values(1,now())\u00a0on\u00a0duplicate\u00a0key\u00a0update\u00a0x=now()\u00a0\u00a0<\/span>\ncanal.instance.detecting.sql\u00a0=\u00a0select\u00a01\u00a0\u00a0\ncanal.instance.detecting.interval.time\u00a0=\u00a03\u00a0\u00a0\ncanal.instance.detecting.retry.threshold\u00a0=\u00a03\u00a0\u00a0\ncanal.instance.detecting.heartbeatHaEnable\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0support\u00a0maximum\u00a0transaction\u00a0size,\u00a0more\u00a0than\u00a0the\u00a0size\u00a0of\u00a0the\u00a0transaction\u00a0will\u00a0be\u00a0cut\u00a0into\u00a0multiple\u00a0transactions\u00a0delivery\u00a0\u00a0<\/span>\ncanal.instance.transaction.size\u00a0=\u00a0\u00a01024\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0mysql\u00a0fallback\u00a0connected\u00a0to\u00a0new\u00a0master\u00a0should\u00a0fallback\u00a0times\u00a0\u00a0<\/span>\ncanal.instance.fallbackIntervalInSeconds\u00a0=\u00a060\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0network\u00a0config\u00a0\u00a0<\/span>\ncanal.instance.network.receiveBufferSize\u00a0=\u00a016384\u00a0\u00a0\ncanal.instance.network.sendBufferSize\u00a0=\u00a016384\u00a0\u00a0\ncanal.instance.network.soTimeout\u00a0=\u00a030\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0binlog\u00a0filter\u00a0config\u00a0\u00a0<\/span>\ncanal.instance.filter.druid.ddl\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">true<\/span>\u00a0\u00a0\ncanal.instance.filter.query.dcl\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\ncanal.instance.filter.query.dml\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\ncanal.instance.filter.query.ddl\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\ncanal.instance.filter.table.error\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\ncanal.instance.filter.rows\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\ncanal.instance.filter.transaction.entry\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\ncanal.instance.filter.dml.insert\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\ncanal.instance.filter.dml.update\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\ncanal.instance.filter.dml.delete\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0binlog\u00a0format\/image\u00a0check\u00a0\u00a0<\/span>\ncanal.instance.binlog.format\u00a0=\u00a0ROW,STATEMENT,MIXED\u00a0\u00a0\u00a0\ncanal.instance.binlog.image\u00a0=\u00a0FULL,MINIMAL,NOBLOB\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0binlog\u00a0ddl\u00a0isolation\u00a0\u00a0<\/span>\ncanal.instance.get.ddl.isolation\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0parallel\u00a0parser\u00a0config\u00a0\u00a0<\/span>\ncanal.instance.parser.parallel\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">true<\/span>\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##\u00a0concurrent\u00a0thread\u00a0number,\u00a0default\u00a060%\u00a0available\u00a0processors,\u00a0suggest\u00a0not\u00a0to\u00a0exceed\u00a0Runtime.getRuntime().availableProcessors()\u00a0\u00a0<\/span>\ncanal.instance.parser.parallelThreadSize\u00a0=\u00a016\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##\u00a0disruptor\u00a0ringbuffer\u00a0size,\u00a0must\u00a0be\u00a0power\u00a0of\u00a02\u00a0\u00a0<\/span>\ncanal.instance.parser.parallelBufferSize\u00a0=\u00a0256\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0table\u00a0meta\u00a0tsdb\u00a0info\u00a0\u00a0<\/span>\ncanal.instance.tsdb.enable\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">true<\/span>\u00a0\u00a0\ncanal.instance.tsdb.dir\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">${canal.file.data.dir:..\/conf}<\/span>\/<span style=\"color: #d19a66; line-height: 26px;\">${canal.instance.destination:}<\/span>\u00a0\u00a0\ncanal.instance.tsdb.url\u00a0=\u00a0jdbc:h2:<span style=\"color: #d19a66; line-height: 26px;\">${canal.instance.tsdb.dir}<\/span>\/h2;CACHE_SIZE=1000;MODE=MYSQL;\u00a0\u00a0\ncanal.instance.tsdb.dbUsername\u00a0=\u00a0canal\u00a0\u00a0\ncanal.instance.tsdb.dbPassword\u00a0=\u00a0canal\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0dump\u00a0snapshot\u00a0interval,\u00a0default\u00a024\u00a0hour\u00a0\u00a0<\/span>\ncanal.instance.tsdb.snapshot.interval\u00a0=\u00a024\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0purge\u00a0snapshot\u00a0expire\u00a0,\u00a0default\u00a0360\u00a0hour(15\u00a0days)\u00a0\u00a0<\/span>\ncanal.instance.tsdb.snapshot.expire\u00a0=\u00a0360\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#################################################\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#########\u00a0\u00a0\u00a0\u00a0\u00a0destinations\u00a0\u00a0\u00a0\u00a0#############\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#################################################\u00a0\u00a0<\/span>\ncanal.destinations\u00a0=\u00a0canal-exchange\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0conf\u00a0root\u00a0dir\u00a0\u00a0<\/span>\ncanal.conf.dir\u00a0=\u00a0..\/conf\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0auto\u00a0scan\u00a0instance\u00a0dir\u00a0add\/remove\u00a0and\u00a0start\/stop\u00a0instance\u00a0\u00a0<\/span>\ncanal.auto.scan\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">true<\/span>\u00a0\u00a0\ncanal.auto.scan.interval\u00a0=\u00a05\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0set\u00a0this\u00a0value\u00a0to\u00a0'true'\u00a0means\u00a0that\u00a0when\u00a0binlog\u00a0pos\u00a0not\u00a0found,\u00a0skip\u00a0to\u00a0latest.\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0WARN:\u00a0pls\u00a0keep\u00a0'false'\u00a0in\u00a0production\u00a0env,\u00a0or\u00a0if\u00a0you\u00a0know\u00a0what\u00a0you\u00a0want.\u00a0\u00a0<\/span>\ncanal.auto.reset.latest.pos.mode\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\n\u00a0\u00a0\ncanal.instance.tsdb.spring.xml\u00a0=\u00a0classpath:spring\/tsdb\/h2-tsdb.xml\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.tsdb.spring.xml\u00a0=\u00a0classpath:spring\/tsdb\/mysql-tsdb.xml\u00a0\u00a0<\/span>\n\u00a0\u00a0\ncanal.instance.global.mode\u00a0=\u00a0spring\u00a0\u00a0\ncanal.instance.global.lazy\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\ncanal.instance.global.manager.address\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">${canal.admin.manager}<\/span>\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.global.spring.xml\u00a0=\u00a0classpath:spring\/memory-instance.xml\u00a0\u00a0<\/span>\ncanal.instance.global.spring.xml\u00a0=\u00a0classpath:spring\/file-instance.xml\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.global.spring.xml\u00a0=\u00a0classpath:spring\/default-instance.xml\u00a0\u00a0<\/span>\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##################################################\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#########\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MQ\u00a0Properties\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#############\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##################################################\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0aliyun\u00a0ak\/sk\u00a0,\u00a0support\u00a0rds\/mq\u00a0\u00a0<\/span>\ncanal.aliyun.accessKey\u00a0=\u00a0\u00a0\ncanal.aliyun.secretKey\u00a0=\u00a0\u00a0\ncanal.aliyun.uid=\u00a0\u00a0\n\u00a0\u00a0\ncanal.mq.flatMessage\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">true<\/span>\u00a0\u00a0\ncanal.mq.canalBatchSize\u00a0=\u00a050\u00a0\u00a0\ncanal.mq.canalGetTimeout\u00a0=\u00a0100\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0Set\u00a0this\u00a0value\u00a0to\u00a0\"cloud\",\u00a0if\u00a0you\u00a0want\u00a0open\u00a0message\u00a0trace\u00a0feature\u00a0in\u00a0aliyun.\u00a0\u00a0<\/span>\ncanal.mq.accessChannel\u00a0=\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">local<\/span>\u00a0\u00a0\n\u00a0\u00a0\ncanal.mq.database.hash\u00a0=\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">true<\/span>\u00a0\u00a0\ncanal.mq.send.thread.size\u00a0=\u00a030\u00a0\u00a0\ncanal.mq.build.thread.size\u00a0=\u00a08\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##################################################\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#########\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0RabbitMQ\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#############\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##################################################\u00a0\u00a0<\/span>\nrabbitmq.host\u00a0=\u00a0myrabbit\u00a0\u00a0\nrabbitmq.virtual.host\u00a0=\u00a0\/\u00a0\u00a0\nrabbitmq.exchange\u00a0=\u00a0canal-exchange\u00a0\u00a0\nrabbitmq.username\u00a0=\u00a0admin\u00a0\u00a0\nrabbitmq.password\u00a0=\u00a0RabbitMQ\u5bc6\u7801\u00a0\u00a0\nrabbitmq.deliveryMode\u00a0=\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6b64\u65f6<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">canal.serverMode = tcp<\/code>\uff0c\u5373TCP\u76f4\u8fde\uff0c\u6211\u4eec\u5148\u5f00\u542f\u8fd9\u4e2a\u670d\u52a1\uff0c\u7136\u540e\u624b\u5199Java\u5ba2\u6237\u7aef\u4ee3\u7801\u53bb\u8fde\u63a5\u5b83\uff0c\u7b49\u4e0b\u518d\u6539\u4e3aRabbitMQ\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u901a\u8fc7\u6ce8\u91ca\u53ef\u4ee5\u770b\u5230\uff0ccanal\u652f\u6301\u7684\u670d\u52a1\u6a21\u5f0f\u6709\uff1atcp, kafka, rocketMQ, rabbitMQ, pulsarMQ\uff0c\u5373\u4e3b\u6d41\u7684\u6d88\u606f\u961f\u5217\u90fd\u652f\u6301\u3002<\/p>\n<h4 style=\"font-weight: bold; margin: 0.6em auto; font-size: 1.2em; padding-left: 10px; border-left: 2px dashed #009688;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">instance.properties<\/h4>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#################################################\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##\u00a0mysql\u00a0serverId\u00a0,\u00a0v1.0.26+\u00a0will\u00a0autoGen\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.mysql.slaveId=123\u00a0\u00a0<\/span>\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0enable\u00a0gtid\u00a0use\u00a0true\/false\u00a0\u00a0<\/span>\ncanal.instance.gtidon=<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0position\u00a0info\u00a0\u00a0<\/span>\ncanal.instance.master.address=mymysql:3306\u00a0\u00a0\ncanal.instance.master.journal.name=\u00a0\u00a0\ncanal.instance.master.position=\u00a0\u00a0\ncanal.instance.master.timestamp=\u00a0\u00a0\ncanal.instance.master.gtid=\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0rds\u00a0oss\u00a0binlog\u00a0\u00a0<\/span>\ncanal.instance.rds.accesskey=\u00a0\u00a0\ncanal.instance.rds.secretkey=\u00a0\u00a0\ncanal.instance.rds.instanceId=\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0table\u00a0meta\u00a0tsdb\u00a0info\u00a0\u00a0<\/span>\ncanal.instance.tsdb.enable=<span style=\"color: #56b6c2; line-height: 26px;\">true<\/span>\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.tsdb.url=jdbc:mysql:\/\/127.0.0.1:3306\/canal_tsdb\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.tsdb.dbUsername=canal\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.tsdb.dbPassword=canal\u00a0\u00a0<\/span>\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.standby.address\u00a0=\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.standby.journal.name\u00a0=\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.standby.position\u00a0=\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.standby.timestamp\u00a0=\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.standby.gtid=\u00a0\u00a0<\/span>\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0username\/password\u00a0\u00a0<\/span>\ncanal.instance.dbUsername=canal\u00a0\u00a0\ncanal.instance.dbPassword=canal\u00a0\u00a0\ncanal.instance.connectionCharset\u00a0=\u00a0UTF-8\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0enable\u00a0druid\u00a0Decrypt\u00a0database\u00a0password\u00a0\u00a0<\/span>\ncanal.instance.enableDruid=<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span>\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.pwdPublicKey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALK4BUxdDltRRE5\/zXpVEVPUgunvscYFtEip3pmLlhrWpacX7y7GCMo2\/JM6LeHmiiNdH1FWgGCpUfircSwlWKUCAwEAAQ==\u00a0\u00a0<\/span>\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0table\u00a0regex\u00a0\u00a0<\/span>\ncanal.instance.filter.regex=.*..*\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0table\u00a0black\u00a0regex\u00a0\u00a0<\/span>\ncanal.instance.filter.black.regex=mysql.slave_.*\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0table\u00a0field\u00a0filter(format:\u00a0schema1.tableName1:field1\/field2,schema2.tableName2:field1\/field2)\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.filter.field=test1.t_product:id\/subject\/keywords,test2.t_company:id\/name\/contact\/ch\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0table\u00a0field\u00a0black\u00a0filter(format:\u00a0schema1.tableName1:field1\/field2,schema2.tableName2:field1\/field2)\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.instance.filter.black.field=test1.t_product:subject\/product_image,test2.t_company:id\/name\/contact\/ch\u00a0\u00a0<\/span>\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0mq\u00a0config\u00a0\u00a0<\/span>\ncanal.mq.topic=canal-routing-key\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0dynamic\u00a0topic\u00a0route\u00a0by\u00a0schema\u00a0or\u00a0table\u00a0regex\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#canal.mq.dynamicTopic=mytest1.user,topic2:mytest2..*,.*..*\u00a0\u00a0<\/span>\ncanal.mq.partition=0\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u628a\u8fd9\u4e24\u4e2a\u914d\u7f6e\u6587\u4ef6\u6620\u5c04\u597d\uff0c\u518d\u6b21\u63d0\u9192\uff0c\u6ce8\u610f\u5b9e\u4f8b\u7684\u8def\u5f84\u540d\uff0c\u9ed8\u8ba4\u662f\uff1a<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">\/example\/instance.properties<\/code><\/p>\n<h4 style=\"font-weight: bold; margin: 0.6em auto; font-size: 1.2em; padding-left: 10px; border-left: 2px dashed #009688;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4fee\u6539canal\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6211\u4eec\u9700\u8981\u4fee\u6539\u8fd9\u4e2a\u5b9e\u4f8b\u914d\u7f6e\u6587\u4ef6\uff0c\u53bb\u8fde\u63a5MySQL\uff0c\u786e\u4fdd\u4ee5\u4e0b\u7684\u914d\u7f6e\u6b63\u786e\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\">canal.instance.master.address=mymysql:3306\u00a0\u00a0\ncanal.instance.dbUsername=canal\u00a0\u00a0\ncanal.instance.dbPassword=canal\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">mymysql\u662f\u540c\u4e3adocker\u5bb9\u5668\u7684MySQL\u73af\u5883\uff0c\u7aef\u53e33306\u662f\u6307\u5185\u90e8\u7aef\u53e3\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u8fd9\u91cc\u591a\u8bf4\u660e\u4e00\u4e0b\uff0cdocker\u7aef\u53e3\u914d\u7f6e\u65f6\u5047\u8bbe\u4e3a\uff1a13306:3306\uff0c\u90a3\u4e48\u5bb9\u5668\u5bf9\u5916\u7684\u7aef\u53e3\u5c31\u662f13306\uff0c\u5185\u90e8\u662f3306\uff0c\u5728\u672c\u793a\u4f8b\u4e2d\uff0cMySQL\u548cCanal\u90fd\u662f\u5bb9\u5668\u73af\u5883\uff0c\u6240\u4ee5Canal\u8fde\u63a5MySQL\u9700\u8981\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6\uff1a<\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; text-align: justify;\">\u5904\u4e8e\u540c\u4e00\u7f51\u6bb5\uff08docker-compose.yml\u4e2d\u7684mynetwork\uff09<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; text-align: justify;\">\u8bbf\u95ee\u5185\u90e8\u7aef\u53e3\uff08\u53733306\uff0c\u800c\u975e13306\uff09<\/p>\n<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">dbUsername\u548cdbPassword\u4e3aMySQL\u8d26\u53f7\u5bc6\u7801\uff0c\u4e3a\u4e86\u5f00\u53d1\u65b9\u4fbf\u53ef\u4ee5\u4f7f\u7528root\/root\uff0c\u4f46\u662f\u6211\u4ecd\u5efa\u8bae\u81ea\u884c\u521b\u5efa\u7528\u6237\u5e76\u5206\u914d\u8bbf\u95ee\u6743\u9650\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u8fdb\u5165docker\u4e2d\u7684mysql\u5bb9\u5668\u00a0\u00a0<\/span>\ndocker\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">exec<\/span>\u00a0-it\u00a0mymysql\u00a0bash\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u8fdb\u5165mysql\u6307\u4ee4\u6a21\u5f0f\u00a0\u00a0<\/span>\nmysql\u00a0-uroot\u00a0-proot\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u7f16\u5199MySQL\u8bed\u53e5\u5e76\u6267\u884c\u00a0\u00a0<\/span>\n&gt;\u00a0...\u00a0\u00a0\n<\/code><\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">--\u00a0\u9009\u62e9mysql\u00a0\u00a0<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">use<\/span>\u00a0mysql;\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">--\u00a0\u521b\u5efacanal\u7528\u6237\uff0c\u8d26\u5bc6\uff1acanal\/canal\u00a0\u00a0<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">create<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">user<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">'canal'<\/span>@<span style=\"color: #98c379; line-height: 26px;\">'%'<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">identified<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">by<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">'canal'<\/span>;\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">--\u00a0\u5206\u914d\u6743\u9650\uff0c\u4ee5\u53ca\u5141\u8bb8\u6240\u6709\u4e3b\u673a\u767b\u5f55\u8be5\u7528\u6237\u00a0\u00a0<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">grant<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">SELECT<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">INSERT<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">UPDATE<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">DELETE<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">REPLICATION<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">SLAVE<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">REPLICATION<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">CLIENT<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">on<\/span>\u00a0*.*\u00a0<span style=\"color: #c678dd; line-height: 26px;\">to<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">'canal'<\/span>@<span style=\"color: #98c379; line-height: 26px;\">'%'<\/span>;\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">--\u00a0\u5237\u65b0\u4e00\u4e0b\u4f7f\u5176\u751f\u6548\u00a0\u00a0<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">flush<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">privileges<\/span>;\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">--\u00a0\u9644\u5e26\u4e00\u4e2a\u5220\u9664\u7528\u6237\u6307\u4ee4\u00a0\u00a0<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">drop<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">user<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">'canal'<\/span>@<span style=\"color: #98c379; line-height: 26px;\">'%'<\/span>;\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u7528navicat\u6216\u8005shell\u53bb\u767b\u5f55canal\u8fd9\u4e2a\u7528\u6237\uff0c\u53ef\u4ee5\u8bbf\u95ee\u5373\u521b\u5efa\u6210\u529f<\/p>\n<h2 style=\"font-weight: bold; font-size: 22px; color: #009688; padding-left: 10px; margin: 1em auto; border-left: 3px solid #009688;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6574\u5408SpringBoot Canal\u5b9e\u73b0\u5ba2\u6237\u7aef<\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">Maven\u4f9d\u8d56\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">canal.version<\/span>&gt;<\/span>1.1.5<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">canal.version<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">&lt;!--canal--&gt;<\/span>\u00a0\u00a0\n<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">dependency<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">groupId<\/span>&gt;<\/span>com.alibaba.otter<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">groupId<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">artifactId<\/span>&gt;<\/span>canal.client<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">artifactId<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">version<\/span>&gt;<\/span>${canal.version}<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">version<\/span>&gt;<\/span>\u00a0\u00a0\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">dependency<\/span>&gt;<\/span>\u00a0\u00a0\n<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">dependency<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">groupId<\/span>&gt;<\/span>com.alibaba.otter<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">groupId<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">artifactId<\/span>&gt;<\/span>canal.protocol<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">artifactId<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">version<\/span>&gt;<\/span>${canal.version}<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">version<\/span>&gt;<\/span>\u00a0\u00a0\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">dependency<\/span>&gt;<\/span>\u00a0\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u65b0\u589e\u7ec4\u4ef6\u5e76\u542f\u52a8\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0com.alibaba.otter.canal.client.CanalConnector;\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0com.alibaba.otter.canal.client.CanalConnectors;\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0com.alibaba.otter.canal.protocol.CanalEntry;\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0com.alibaba.otter.canal.protocol.Message;\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0org.springframework.boot.CommandLineRunner;\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0org.springframework.stereotype.Component;\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0java.net.InetSocketAddress;\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0java.util.List;\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #61aeee; line-height: 26px;\">@Component<\/span>\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">CanalClient<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">final<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">static<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0BATCH_SIZE\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">1000<\/span>;\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">void<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">run<\/span><span style=\"line-height: 26px;\">()<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u521b\u5efa\u94fe\u63a5\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0CanalConnector\u00a0connector\u00a0=\u00a0CanalConnectors.newSingleConnector(<span style=\"color: #c678dd; line-height: 26px;\">new<\/span>\u00a0InetSocketAddress(<span style=\"color: #98c379; line-height: 26px;\">\"localhost\"<\/span>,\u00a0<span style=\"color: #d19a66; line-height: 26px;\">11111<\/span>),\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"canal-exchange\"<\/span>,\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"canal\"<\/span>,\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"canal\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">try<\/span>\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u6253\u5f00\u8fde\u63a5\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0connector.connect();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u8ba2\u9605\u6570\u636e\u5e93\u8868,\u5168\u90e8\u8868\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0connector.subscribe(<span style=\"color: #98c379; line-height: 26px;\">\".*..*\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u56de\u6eda\u5230\u672a\u8fdb\u884cack\u7684\u5730\u65b9\uff0c\u4e0b\u6b21fetch\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u4ece\u6700\u540e\u4e00\u4e2a\u6ca1\u6709ack\u7684\u5730\u65b9\u5f00\u59cb\u62ff\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0connector.rollback();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">while<\/span>\u00a0(<span style=\"color: #c678dd; line-height: 26px;\">true<\/span>)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u83b7\u53d6\u6307\u5b9a\u6570\u91cf\u7684\u6570\u636e\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Message\u00a0message\u00a0=\u00a0connector.getWithoutAck(BATCH_SIZE);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u83b7\u53d6\u6279\u91cfID\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">long<\/span>\u00a0batchId\u00a0=\u00a0message.getId();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u83b7\u53d6\u6279\u91cf\u7684\u6570\u91cf\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0size\u00a0=\u00a0message.getEntries().size();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u5982\u679c\u6ca1\u6709\u6570\u636e\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0(batchId\u00a0==\u00a0-<span style=\"color: #d19a66; line-height: 26px;\">1<\/span>\u00a0||\u00a0size\u00a0==\u00a0<span style=\"color: #d19a66; line-height: 26px;\">0<\/span>)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">try<\/span>\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u7ebf\u7a0b\u4f11\u77202\u79d2\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Thread.sleep(<span style=\"color: #d19a66; line-height: 26px;\">2000<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0<span style=\"color: #c678dd; line-height: 26px;\">catch<\/span>\u00a0(InterruptedException\u00a0e)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0e.printStackTrace();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0<span style=\"color: #c678dd; line-height: 26px;\">else<\/span>\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u5982\u679c\u6709\u6570\u636e,\u5904\u7406\u6570\u636e\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0printEntry(message.getEntries());\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u8fdb\u884c\u00a0batch\u00a0id\u00a0\u7684\u786e\u8ba4\u3002\u786e\u8ba4\u4e4b\u540e\uff0c\u5c0f\u4e8e\u7b49\u4e8e\u6b64\u00a0batchId\u00a0\u7684\u00a0Message\u00a0\u90fd\u4f1a\u88ab\u786e\u8ba4\u3002\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0connector.ack(batchId);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0<span style=\"color: #c678dd; line-height: 26px;\">catch<\/span>\u00a0(Exception\u00a0e)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0e.printStackTrace();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0<span style=\"color: #c678dd; line-height: 26px;\">finally<\/span>\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0connector.disconnect();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/**\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0\u6253\u5370canal\u00a0server\u89e3\u6790binlog\u83b7\u5f97\u7684\u5b9e\u4f53\u7c7b\u4fe1\u606f\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\/<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">private<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">static<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">void<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">printEntry<\/span><span style=\"line-height: 26px;\">(List&lt;CanalEntry.Entry&gt;\u00a0entrys)<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">for<\/span>\u00a0(CanalEntry.Entry\u00a0entry\u00a0:\u00a0entrys)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0(entry.getEntryType()\u00a0==\u00a0CanalEntry.EntryType.TRANSACTIONBEGIN\u00a0||\u00a0entry.getEntryType()\u00a0==\u00a0CanalEntry.EntryType.TRANSACTIONEND)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u5f00\u542f\/\u5173\u95ed\u4e8b\u52a1\u7684\u5b9e\u4f53\u7c7b\u578b\uff0c\u8df3\u8fc7\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">continue<\/span>;\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/RowChange\u5bf9\u8c61\uff0c\u5305\u542b\u4e86\u4e00\u884c\u6570\u636e\u53d8\u5316\u7684\u6240\u6709\u7279\u5f81\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u6bd4\u5982isDdl\u00a0\u662f\u5426\u662fddl\u53d8\u66f4\u64cd\u4f5c\u00a0sql\u00a0\u5177\u4f53\u7684ddl\u00a0sql\u00a0beforeColumns\u00a0afterColumns\u00a0\u53d8\u66f4\u524d\u540e\u7684\u6570\u636e\u5b57\u6bb5\u7b49\u7b49\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0CanalEntry.RowChange\u00a0rowChage;\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">try<\/span>\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0rowChage\u00a0=\u00a0CanalEntry.RowChange.parseFrom(entry.getStoreValue());\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0<span style=\"color: #c678dd; line-height: 26px;\">catch<\/span>\u00a0(Exception\u00a0e)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">throw<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">new<\/span>\u00a0RuntimeException(<span style=\"color: #98c379; line-height: 26px;\">\"ERROR\u00a0##\u00a0parser\u00a0of\u00a0eromanga-event\u00a0has\u00a0an\u00a0error\u00a0,\u00a0data:\"<\/span>\u00a0+\u00a0entry.toString(),\u00a0e);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u83b7\u53d6\u64cd\u4f5c\u7c7b\u578b\uff1ainsert\/update\/delete\u7c7b\u578b\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0CanalEntry.EventType\u00a0eventType\u00a0=\u00a0rowChage.getEventType();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u6253\u5370Header\u4fe1\u606f\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(String.format(<span style=\"color: #98c379; line-height: 26px;\">\"================\u300b;\u00a0binlog[%s:%s]\u00a0,\u00a0name[%s,%s]\u00a0,\u00a0eventType\u00a0:\u00a0%s\"<\/span>,\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0entry.getHeader().getLogfileName(),\u00a0entry.getHeader().getLogfileOffset(),\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0entry.getHeader().getSchemaName(),\u00a0entry.getHeader().getTableName(),\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0eventType));\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u5224\u65ad\u662f\u5426\u662fDDL\u8bed\u53e5\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0(rowChage.getIsDdl())\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(<span style=\"color: #98c379; line-height: 26px;\">\"================\u300b;isDdl:\u00a0true,sql:\"<\/span>\u00a0+\u00a0rowChage.getSql());\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u83b7\u53d6RowChange\u5bf9\u8c61\u91cc\u7684\u6bcf\u4e00\u884c\u6570\u636e\uff0c\u6253\u5370\u51fa\u6765\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">for<\/span>\u00a0(CanalEntry.RowData\u00a0rowData\u00a0:\u00a0rowChage.getRowDatasList())\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u5982\u679c\u662f\u5220\u9664\u8bed\u53e5\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0(eventType\u00a0==\u00a0CanalEntry.EventType.DELETE)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0printColumn(rowData.getBeforeColumnsList());\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u5982\u679c\u662f\u65b0\u589e\u8bed\u53e5\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0<span style=\"color: #c678dd; line-height: 26px;\">else<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0(eventType\u00a0==\u00a0CanalEntry.EventType.INSERT)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0printColumn(rowData.getAfterColumnsList());\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u5982\u679c\u662f\u66f4\u65b0\u7684\u8bed\u53e5\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0<span style=\"color: #c678dd; line-height: 26px;\">else<\/span>\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u53d8\u66f4\u524d\u7684\u6570\u636e\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(<span style=\"color: #98c379; line-height: 26px;\">\"-------&gt;;\u00a0before\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0printColumn(rowData.getBeforeColumnsList());\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u53d8\u66f4\u540e\u7684\u6570\u636e\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(<span style=\"color: #98c379; line-height: 26px;\">\"-------&gt;;\u00a0after\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0printColumn(rowData.getAfterColumnsList());\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">private<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">static<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">void<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">printColumn<\/span><span style=\"line-height: 26px;\">(List&lt;CanalEntry.Column&gt;\u00a0columns)<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">for<\/span>\u00a0(CanalEntry.Column\u00a0column\u00a0:\u00a0columns)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(column.getName()\u00a0+\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\u00a0:\u00a0\"<\/span>\u00a0+\u00a0column.getValue()\u00a0+\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"\u00a0\u00a0\u00a0\u00a0update=\"<\/span>\u00a0+\u00a0column.getUpdated());\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n}\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u542f\u52a8\u7c7bApplication\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #61aeee; line-height: 26px;\">@SpringBootApplication<\/span>\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">BaseApplication<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">implements<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">CommandLineRunner<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #61aeee; line-height: 26px;\">@Autowired<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>\u00a0CanalClient\u00a0canalClient;\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #61aeee; line-height: 26px;\">@Override<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">void<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">run<\/span><span style=\"line-height: 26px;\">(String...\u00a0args)<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">throws<\/span>\u00a0Exception\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0canalClient.run();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n}\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u542f\u52a8\u7a0b\u5e8f\uff0c\u6b64\u65f6\u65b0\u589e\u6216\u4fee\u6539\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\uff0c\u6211\u4eec\u5c31\u80fd\u4ece\u5ba2\u6237\u7aef\u4e2d\u76d1\u542c\u5230<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4e0d\u8fc7\u6211\u5efa\u8bae\u76d1\u542c\u7684\u4fe1\u606f\u653e\u5230\u6d88\u606f\u961f\u5217\u4e2d\uff0c\u5728\u7a7a\u95f2\u7684\u65f6\u5019\u53bb\u5904\u7406\uff0c\u6240\u4ee5\u76f4\u63a5\u914d\u7f6eCanal\u6574\u5408RabbitMQ\u66f4\u597d\u3002<\/p>\n<h2 style=\"font-weight: bold; font-size: 22px; color: #009688; padding-left: 10px; margin: 1em auto; border-left: 3px solid #009688;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">Canal\u6574\u5408RabbitMQ<\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4fee\u6539canal.properties\u4e2d\u7684serverMode\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\">canal.serverMode\u00a0=\u00a0rabbitMQ\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4fee\u6539instance.properties\u4e2d\u7684topic\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\">canal.mq.topic=canal-routing-key\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u7136\u540e\u627e\u5230\u5173\u4e8eRabbitMQ\u7684\u914d\u7f6e\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##################################################\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#########\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0RabbitMQ\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#############\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">##################################################\u00a0\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u8fde\u63a5rabbit\uff0c\u5199IP\uff0c\u56e0\u4e3a\u540c\u4e2a\u7f51\u7edc\u4e0b\uff0c\u6240\u4ee5\u53ef\u4ee5\u5199\u5bb9\u5668\u540d\u00a0\u00a0<\/span>\nrabbitmq.host\u00a0=\u00a0myrabbit\u00a0\u00a0\nrabbitmq.virtual.host\u00a0=\u00a0\/\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u4ea4\u6362\u5668\u540d\u79f0\uff0c\u7b49\u7b49\u6211\u4eec\u8981\u53bb\u624b\u52a8\u521b\u5efa\u00a0\u00a0<\/span>\nrabbitmq.exchange\u00a0=\u00a0canal-exchange\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u8d26\u5bc6\u00a0\u00a0<\/span>\nrabbitmq.username\u00a0=\u00a0admin\u00a0\u00a0\nrabbitmq.password\u00a0=\u00a0123456\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u6682\u4e0d\u652f\u6301\u6307\u5b9a\u7aef\u53e3\uff0c\u4f7f\u7528\u7684\u662f\u9ed8\u8ba4\u76845762\uff0c\u597d\u5728\u5728\u672c\u793a\u4f8b\u4e2d\u9002\u7528\u00a0\u00a0<\/span>\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u91cd\u65b0\u542f\u52a8\u5bb9\u5668\uff0c\u8fdb\u5165RabbitMQ\u7ba1\u7406\u9875\u9762\u521b\u5efaexchange\u4ea4\u6362\u5668\u548c\u961f\u5217queue\uff1a<\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u65b0\u5efaexchange\uff0c\u547d\u540d\u4e3a\uff1a<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">canal-exchange<\/code><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u65b0\u5efaqueue\uff0c\u547d\u540d\u4e3a\uff1a<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">canal-queue<\/code><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u7ed1\u5b9aexchange\u548cqueue\uff0crouting-key\u8bbe\u7f6e\u4e3a\uff1a<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">canal-routing-key<\/code>\uff0c\u8fd9\u91cc\u5bf9\u5e94\u4e0a\u9762<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">instance.properties<\/code>\u7684<code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #009688;\">canal.mq.topic<\/code><\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u987a\u5e26\u4e00\u63d0\uff0c\u4e0a\u9762\u8fd9\u6bb5\u53ef\u4ee5\u5ffd\u7565\uff0c\u56e0\u4e3a\u5728SpringBoot\u7684RabbitMQ\u914d\u7f6e\u4e2d\uff0c\u4f1a\u81ea\u52a8\u521b\u5efa\u4ea4\u6362\u5668exchange\u548c\u961f\u5217queue\uff0c\u4e0d\u8fc7\u624b\u52a8\u521b\u5efa\u7684\u8bdd\uff0c\u53ef\u4ee5\u5728\u5ffd\u7565SpringBoot\u7684\u57fa\u7840\u4e0a\uff0c\u76f4\u63a5\u5728RabbitMQ\u7684\u7ba1\u7406\u9875\u9762\u4e0a\u770b\u5230\u4fee\u6539\u8bb0\u5f55\u7684\u6d88\u606f\u3002<\/p>\n<h2 style=\"font-weight: bold; font-size: 22px; color: #009688; padding-left: 10px; margin: 1em auto; border-left: 3px solid #009688;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">SpringBoot\u6574\u5408RabbitMQ<\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4f9d\u8d56\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">amqp.version<\/span>&gt;<\/span>2.3.4.RELEASE<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">amqp.version<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">&lt;!--\u6d88\u606f\u961f\u5217--&gt;<\/span>\u00a0\u00a0\n<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">dependency<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">groupId<\/span>&gt;<\/span>org.springframework.boot<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">groupId<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">artifactId<\/span>&gt;<\/span>spring-boot-starter-amqp<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">artifactId<\/span>&gt;<\/span>\u00a0\u00a0\n\u00a0\u00a0<span style=\"line-height: 26px;\">&lt;<span style=\"color: #e06c75; line-height: 26px;\">version<\/span>&gt;<\/span>${amqp.version}<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">version<\/span>&gt;<\/span>\u00a0\u00a0\n<span style=\"line-height: 26px;\">&lt;\/<span style=\"color: #e06c75; line-height: 26px;\">dependency<\/span>&gt;<\/span>\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><strong>application.yml<\/strong>\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #d19a66; line-height: 26px;\">spring:<\/span>\u00a0\u00a0\n\u00a0\u00a0<span style=\"color: #d19a66; line-height: 26px;\">rabbitmq:<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u00a0\u00a0\u00a0host:\u00a0myserverhost\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">host:<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">192.168<\/span><span style=\"color: #d19a66; line-height: 26px;\">.0<\/span><span style=\"color: #d19a66; line-height: 26px;\">.108<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">port:<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">5672<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">username:<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">admin<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">password:<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">RabbitMQ\u5bc6\u7801<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u6d88\u606f\u786e\u8ba4\u914d\u7f6e\u9879\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u786e\u8ba4\u6d88\u606f\u5df2\u53d1\u9001\u5230\u4ea4\u6362\u673a(Exchange)\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">publisher-confirm-type:<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">correlated<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u786e\u8ba4\u6d88\u606f\u5df2\u53d1\u9001\u5230\u961f\u5217(Queue)\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">publisher-returns:<\/span>\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">true<\/span>\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">RabbitMQ\u914d\u7f6e\u7c7b\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #61aeee; line-height: 26px;\">@Configuration<\/span>\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">RabbitConfig<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #61aeee; line-height: 26px;\">@Bean<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0RabbitTemplate\u00a0<span style=\"color: #61aeee; line-height: 26px;\">rabbitTemplate<\/span><span style=\"line-height: 26px;\">(ConnectionFactory\u00a0connectionFactory)<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0RabbitTemplate\u00a0template\u00a0=\u00a0<span style=\"color: #c678dd; line-height: 26px;\">new<\/span>\u00a0RabbitTemplate();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0template.setConnectionFactory(connectionFactory);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0template.setMessageConverter(<span style=\"color: #c678dd; line-height: 26px;\">new<\/span>\u00a0Jackson2JsonMessageConverter());\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0template;\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/**\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0template.setMessageConverter(new\u00a0Jackson2JsonMessageConverter());\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0\u8fd9\u6bb5\u548c\u4e0a\u9762\u8fd9\u884c\u4ee3\u7801\u89e3\u51b3RabbitListener\u5faa\u73af\u62a5\u9519\u7684\u95ee\u9898\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\/<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #61aeee; line-height: 26px;\">@Bean<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0SimpleRabbitListenerContainerFactory\u00a0<span style=\"color: #61aeee; line-height: 26px;\">rabbitListenerContainerFactory<\/span><span style=\"line-height: 26px;\">(ConnectionFactory\u00a0connectionFactory)<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SimpleRabbitListenerContainerFactory\u00a0factory\u00a0=\u00a0<span style=\"color: #c678dd; line-height: 26px;\">new<\/span>\u00a0SimpleRabbitListenerContainerFactory();\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0factory.setConnectionFactory(connectionFactory);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0factory.setMessageConverter(<span style=\"color: #c678dd; line-height: 26px;\">new<\/span>\u00a0Jackson2JsonMessageConverter());\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0factory;\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n}\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">Canal\u6d88\u606f\u751f\u4ea7\u8005\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">static<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">final<\/span>\u00a0String\u00a0CanalQueue\u00a0=\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"canal-queue\"<\/span>;\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">static<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">final<\/span>\u00a0String\u00a0CanalExchange\u00a0=\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"canal-exchange\"<\/span>;\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">static<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">final<\/span>\u00a0String\u00a0CanalRouting\u00a0=\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"canal-routing-key\"<\/span>;\u00a0\u00a0\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/**\u00a0\u00a0\n\u00a0*\u00a0Canal\u6d88\u606f\u63d0\u4f9b\u8005\uff0ccanal-server\u751f\u4ea7\u7684\u6d88\u606f\u901a\u8fc7RabbitMQ\u6d88\u606f\u961f\u5217\u53d1\u9001\u00a0\u00a0\n\u00a0*\/<\/span>\u00a0\u00a0\n<span style=\"color: #61aeee; line-height: 26px;\">@Configuration<\/span>\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">CanalProvider<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/**\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0\u961f\u5217\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\/<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #61aeee; line-height: 26px;\">@Bean<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0Queue\u00a0<span style=\"color: #61aeee; line-height: 26px;\">canalQueue<\/span><span style=\"line-height: 26px;\">()<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/**\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0durable:\u662f\u5426\u6301\u4e45\u5316\uff0c\u9ed8\u8ba4false\uff0c\u6301\u4e45\u5316\u961f\u5217\uff1a\u4f1a\u88ab\u5b58\u50a8\u5728\u78c1\u76d8\u4e0a\uff0c\u5f53\u6d88\u606f\u4ee3\u7406\u91cd\u542f\u65f6\u4ecd\u7136\u5b58\u5728\uff1b\u6682\u5b58\u961f\u5217\uff1a\u5f53\u524d\u8fde\u63a5\u6709\u6548\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0exclusive:\u9ed8\u8ba4\u4e3afalse\uff0c\u53ea\u80fd\u88ab\u5f53\u524d\u521b\u5efa\u7684\u8fde\u63a5\u4f7f\u7528\uff0c\u800c\u4e14\u5f53\u8fde\u63a5\u5173\u95ed\u540e\u961f\u5217\u5373\u88ab\u5220\u9664\u3002\u6b64\u53c2\u8003\u4f18\u5148\u7ea7\u9ad8\u4e8edurable\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0autoDelete:\u662f\u5426\u81ea\u52a8\u5220\u9664\uff0c\u5f53\u6ca1\u6709\u751f\u4ea7\u8005\u6216\u8005\u6d88\u8d39\u8005\u4f7f\u7528\u6b64\u961f\u5217\uff0c\u8be5\u961f\u5217\u4f1a\u81ea\u52a8\u5220\u9664\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0*\/<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">new<\/span>\u00a0Queue(RabbitConstant.CanalQueue,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">true<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/**\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0\u4ea4\u6362\u673a\uff0c\u8fd9\u91cc\u4f7f\u7528\u76f4\u8fde\u4ea4\u6362\u673a\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\/<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #61aeee; line-height: 26px;\">@Bean<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">DirectExchange\u00a0<span style=\"color: #61aeee; line-height: 26px;\">canalExchange<\/span><span style=\"line-height: 26px;\">()<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">new<\/span>\u00a0DirectExchange(RabbitConstant.CanalExchange,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">true<\/span>,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">false<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/**\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\u00a0\u7ed1\u5b9a\u4ea4\u6362\u673a\u548c\u961f\u5217\uff0c\u5e76\u8bbe\u7f6e\u5339\u914d\u952e\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0*\/<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #61aeee; line-height: 26px;\">@Bean<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">Binding\u00a0<span style=\"color: #61aeee; line-height: 26px;\">bindingCanal<\/span><span style=\"line-height: 26px;\">()<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0BindingBuilder.bind(canalQueue()).to(canalExchange()).with(RabbitConstant.CanalRouting);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n}\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">Canal\u6d88\u606f\u6d88\u8d39\u8005\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/**\u00a0\u00a0\n\u00a0*\u00a0Canal\u6d88\u606f\u6d88\u8d39\u8005\u00a0\u00a0\n\u00a0*\/<\/span>\u00a0\u00a0\n<span style=\"color: #61aeee; line-height: 26px;\">@Component<\/span>\u00a0\u00a0\n<span style=\"color: #61aeee; line-height: 26px;\">@RabbitListener<\/span>(queues\u00a0=\u00a0RabbitConstant.CanalQueue)\u00a0\u00a0\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">CanalComsumer<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">final<\/span>\u00a0SysBackupService\u00a0sysBackupService;\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">CanalComsumer<\/span><span style=\"line-height: 26px;\">(SysBackupService\u00a0sysBackupService)<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">this<\/span>.sysBackupService\u00a0=\u00a0sysBackupService;\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #61aeee; line-height: 26px;\">@RabbitHandler<\/span>\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">void<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">process<\/span><span style=\"line-height: 26px;\">(Map&lt;String,\u00a0Object&gt;\u00a0msg)<\/span>\u00a0<\/span>{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(<span style=\"color: #98c379; line-height: 26px;\">\"\u6536\u5230canal\u6d88\u606f\uff1a\"<\/span>\u00a0+\u00a0msg);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">boolean<\/span>\u00a0isDdl\u00a0=\u00a0(<span style=\"color: #c678dd; line-height: 26px;\">boolean<\/span>)\u00a0msg.get(<span style=\"color: #98c379; line-height: 26px;\">\"isDdl\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u4e0d\u5904\u7406DDL\u4e8b\u4ef6\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0(isDdl)\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>;\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0TiCDC\u7684id\uff0c\u5e94\u8be5\u5177\u6709\u552f\u4e00\u6027\uff0c\u5148\u4fdd\u5b58\u518d\u8bf4\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0tid\u00a0=\u00a0(<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>)\u00a0msg.get(<span style=\"color: #98c379; line-height: 26px;\">\"id\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0TiCDC\u751f\u6210\u8be5\u6d88\u606f\u7684\u65f6\u95f4\u6233\uff0c13\u4f4d\u6beb\u79d2\u7ea7\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">long<\/span>\u00a0ts\u00a0=\u00a0(<span style=\"color: #c678dd; line-height: 26px;\">long<\/span>)\u00a0msg.get(<span style=\"color: #98c379; line-height: 26px;\">\"ts\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u6570\u636e\u5e93\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0String\u00a0database\u00a0=\u00a0(String)\u00a0msg.get(<span style=\"color: #98c379; line-height: 26px;\">\"database\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u8868\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0String\u00a0table\u00a0=\u00a0(String)\u00a0msg.get(<span style=\"color: #98c379; line-height: 26px;\">\"table\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u7c7b\u578b\uff1aINSERT\/UPDATE\/DELETE\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0String\u00a0type\u00a0=\u00a0(String)\u00a0msg.get(<span style=\"color: #98c379; line-height: 26px;\">\"type\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u6bcf\u4e00\u5217\u7684\u6570\u636e\u503c\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0List&lt;?&gt;\u00a0data\u00a0=\u00a0(List&lt;?&gt;)\u00a0msg.get(<span style=\"color: #98c379; line-height: 26px;\">\"data\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u4ec5\u5f53type\u4e3aUPDATE\u65f6\u624d\u6709\u503c\uff0c\u8bb0\u5f55\u6bcf\u4e00\u5217\u7684\u540d\u5b57\u548cUPDATE\u4e4b\u524d\u7684\u6570\u636e\u503c\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0List&lt;?&gt;\u00a0old\u00a0=\u00a0(List&lt;?&gt;)\u00a0msg.get(<span style=\"color: #98c379; line-height: 26px;\">\"old\"<\/span>);\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u8df3\u8fc7sys_backup\uff0c\u9632\u6b62\u65e0\u9650\u5faa\u73af\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0(<span style=\"color: #98c379; line-height: 26px;\">\"sys_backup\"<\/span>.equalsIgnoreCase(table))\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>;\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u53ea\u5904\u7406\u6307\u5b9a\u7c7b\u578b\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0(!<span style=\"color: #98c379; line-height: 26px;\">\"INSERT\"<\/span>.equalsIgnoreCase(type)\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&amp;&amp;\u00a0!<span style=\"color: #98c379; line-height: 26px;\">\"UPDATE\"<\/span>.equalsIgnoreCase(type)\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&amp;&amp;\u00a0!<span style=\"color: #98c379; line-height: 26px;\">\"DELETE\"<\/span>.equalsIgnoreCase(type))\u00a0{\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>;\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\n}\u00a0\u00a0\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: justify;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6d4b\u8bd5\u4e00\u4e0b\uff0c\u4fee\u6539MySQL\u4e2d\u7684\u4e00\u6761\u6d88\u606f\uff0cCanal\u5c31\u4f1a\u53d1\u9001\u4fe1\u606f\u5230RabbitMQ\uff0c\u6211\u4eec\u5c31\u80fd\u4ece\u76d1\u542c\u7684RabbitMQ\u961f\u5217\u4e2d\u5f97\u5230\u8be5\u6761\u6d88\u606f\u3002<\/p>\n<\/section>\n<section style=\"margin-bottom: 0px; padding-right: 10px; padding-left: 10px; outline: 0px; letter-spacing: 0.544px; white-space: normal; background-color: #ffffff; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; text-align: left; line-height: 1.6; word-break: break-word; font-size: 15px; color: #595959;\" data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\">\n<section style=\"outline: 0px;\">\n<blockquote style=\"outline: 0px; color: rgba(0, 0, 0, 0.5);\" data-type=\"2\" data-url=\"\" data-author-name=\"\" data-content-utf8-length=\"121\" data-source-title=\"\">\n<section style=\"outline: 0px;\">\n<p style=\"outline: 0px;\"><span style=\"outline: 0px; font-size: 12px;\"><em style=\"outline: 0px;\">\u611f\u8c22\u9605\u8bfb\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u00a0:)\u00a0<\/em><\/span><em style=\"outline: 0px; font-size: 12px; letter-spacing: 0.544px;\">\u6765\u6e90\uff1a<\/em><\/p>\n<p style=\"outline: 0px;\"><em style=\"outline: 0px; font-size: 12px; letter-spacing: 0.544px;\">JAVA\u65e5\u77e5\u5f55\u00a0 \u00a0\u00a0<\/em><\/p>\n<\/section>\n<\/blockquote>\n<\/section>\n<\/section>\n<p style=\"display: none;\">\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42 \u6211\u60f3\u8981\u5728SpringBoot\u4e2d\u91c7\u7528\u4e00\u79cd\u4e0e\u4e1a\u52a1\u4ee3\u7801\u89e3\u8026\u5408\u7684\u65b9\u5f0f\uff0c\u6765\u5b9e\u73b0\u6570\u636e\u7684\u53d8\u66f4\u8bb0\u5f55\uff0c\u8bb0\u5f55\u7684\u5185\u5bb9\u662f\u65b0\u6570\u636e\uff0c\u5982\u679c\u662f\u66f4\u65b0\u64cd\u4f5c\u8fd8\u5f97\u6709 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":310,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[6,7,8],"tags":[],"class_list":["post-309","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring","category-spring-boot","category-spring-cloud"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230527201514347-150x150.jpg","content_first_image":null,"post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230527201514347-300x128.jpg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230527201514347.jpg","post_frist_image":null,"post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230527201514347-300x128.jpg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230527201514347.jpg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230527201514347.jpg","post_all_images":[],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring","post_date":"2023-05-27","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":288,"next_post_id":510,"next_post_title":"SpringBoot\u56db\u5927\u6838\u5fc3\u7ec4\u4ef6\uff0c\u8fd8\u6709\u4eba\u4e0d\u77e5\u9053\uff1f","previous_post_id":279,"previous_post_title":"RabbitMQ \u6709\u54ea\u51e0\u79cd\u6d88\u606f\u6a21\u5f0f\uff1f","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=309"}],"version-history":[{"count":1,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/309\/revisions"}],"predecessor-version":[{"id":3758,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/309\/revisions\/3758"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/310"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}