佳木斯湛栽影视文化发展公司

主頁 > 知識(shí)庫 > mysql-canal-rabbitmq 安裝部署超詳細(xì)教程

mysql-canal-rabbitmq 安裝部署超詳細(xì)教程

熱門標(biāo)簽:鐵路電話系統(tǒng) AI電銷 地方門戶網(wǎng)站 服務(wù)外包 網(wǎng)站排名優(yōu)化 Linux服務(wù)器 百度競(jìng)價(jià)排名 呼叫中心市場(chǎng)需求

原文

1.1. 開啟 MySQL 的 binlog 日志

1.修改 my.cnfmy.ini(windows), 添加配置項(xiàng):

# binlog 日志存放路徑
log-bin=D:\env\mysql-5.7.28-winx64\binlog
# 日志中記錄每一行數(shù)據(jù)被修改的形式
binlog-format=ROW
# 當(dāng)前機(jī)器的服務(wù) ID, 如果為集群時(shí)不能重復(fù)
server_id=1

2.重啟 mysql 服務(wù)后, 查看配置變量是否生效:

mysql> show variables like '%log_bin%';
+---------------------------------+----------------------+
| Variable_name          | Value        |
+---------------------------------+----------------------+
| log_bin             | ON          |
| log_bin_basename        | D:\env\mysql-5    |
| log_bin_index          | D:\env\mysql-5.index |
| log_bin_trust_function_creators | OFF         |
| log_bin_use_v1_row_events    | OFF         |
| sql_log_bin           | ON          |
+---------------------------------+----------------------+
6 rows in set, 1 warning (0.00 sec)

配置 mysql 數(shù)據(jù)庫的 canal 用戶

mysql -uroot -p 登錄 mysql, 創(chuàng)建并授權(quán)用戶 canal;

CREATE USER canal IDENTIFIED BY 'canal';
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%';
FLUSH PRIVILEGES;

1.2. 配置 rabbitmq Exchanges 和 Queues

1.新建 Queue

2.新建 Exchange

3.設(shè)置 Queue 里的 Bindings, 填寫 Exchange 名稱, 以及路由 Routing key;

1.3. 安裝單機(jī) canal

1.3.1. 下載安裝

下載 并解壓縮;

sudo wget https://github.com/alibaba/canal/releases/download/canal-1.1.4/canal.deployer-1.1.4.tar.gz
sudo tar -zxvf canal.deployer-1.1.4.tar.gz

最新版本 1.1.5的安裝

sudo wget https://github.com/alibaba/canal/releases/download/canal-1.1.5-alpha-1/canal.deployer-1.1.5-SNAPSHOT.tar.gz
sudo tar -zxvf canal.deployer-1.1.5-SNAPSHOT.tar.gz

1.3.2. 配置文件

1.3.2.1. 節(jié)點(diǎn)配置文件 canal.properties

# tcp bind ip, 當(dāng)前節(jié)點(diǎn)的 IP 地址
canal.ip = 192.168.2.108
# register ip to zookeeper, 注冊(cè)到 ZK 的 IP 地址, 如下圖1.
canal.register.ip = 192.168.2.108

canal.zkServers = zk集群

# tcp, kafka, RocketMQ, 最新版本 1.1.5 可以直接連接 rabbitmq
canal.serverMode = rabbitmq

# destinations, 當(dāng)前 server 上部署的 instance 列表, 對(duì)應(yīng)各個(gè)實(shí)例文件夾(../conf/instance_name>)名稱
canal.destinations = example2

# 設(shè)置 mq 服務(wù)器地址, 此處為 rabbitmq 的服務(wù)器地址
# !! 此處下載后默認(rèn)的配置是有配置IP:端口的
# rabbitmq 此處則不需要配置端口
canal.mq.servers = 192.168.208.100

# 一下幾項(xiàng)均為 1.1.5 新版本新增支持 rabbitmq 的配置
canal.mq.vhost=/
canal.mq.exchange=example2-ex # 指定 rabbitmq 上的 exchange 名稱, "新建 `Exchange`" 步驟新建的名稱
canal.mq.username=admin # 連接 rabbitmq 的用戶名
canal.mq.password=**** # 連接 rabbitmq 的密碼
canal.mq.aliyunuid=

1.3.2.2. 實(shí)例配置文件 instance.properties

# position info, 數(shù)據(jù)庫的連接信息
canal.instance.master.address=192.168.2.108:3306
# 以下兩個(gè)配置, 需要在上面配置的 address 的數(shù)據(jù)庫中執(zhí)行 `SHOW MASTER STATUS` 獲取的 `File` 和 `Position` 兩個(gè)字段值
canal.instance.master.journal.name=mysql-5.7
canal.instance.master.position=674996

# table meta tsdb info, 禁用 tsdb 記錄 table meta 的時(shí)間序列版本
canal.instance.tsdb.enable=false

# username/password, 實(shí)例連接數(shù)據(jù)的用戶名和密碼
canal.instance.dbUsername=canal
canal.instance.dbPassword=canal

# table regex, 正則匹配需要監(jiān)聽的數(shù)據(jù)庫表
canal.instance.filter.regex=ysb\\.useropcosttimes_prod

# mq config, 指定 rabbitmq 設(shè)置綁定的路由, 詳見"配置rabbitmq"步驟里的第三步配置的`Routing key`
canal.mq.topic=example2-routingkey

1.3.3. 啟動(dòng) canal 服務(wù)

Linux 對(duì)應(yīng)的啟動(dòng)腳本 ./bin/startup.sh, Windows 對(duì)應(yīng)的啟動(dòng)腳本 ./bin/startup.bat; 以 Windows 為例:

λ .\startup.bat
start cmd : java  -Xms128m -Xmx512m -XX:PermSize=128m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9099,server=y,suspend=n -DappName=otter-canal -Dlogback.configurationFile="d:\env\green\canal-1.1.5\bin\\..\conf\logback.xml" -Dcanal.conf="d:\env\green\canal-1.1.5\bin\\..\conf\canal.properties" -classpath "d:\env\green\canal-1.1.5\bin\\..\conf\..\lib\*;d:\env\green\canal-1.1.5\bin\\..\conf" java  -Xms128m -Xmx512m -XX:PermSize=128m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9099,server=y,suspend=n -DappName=otter-canal -Dlogback.configurationFile="d:\env\green\canal-1.1.5\bin\\..\conf\logback.xml" -Dcanal.conf="d:\env\green\canal-1.1.5\bin\\..\conf\canal.properties" -classpath "d:\env\green\canal-1.1.5\bin\\..\conf\..\lib\*;d:\env\green\canal-1.1.5\bin\\..\conf" com.alibaba.otter.canal.deployer.CanalLauncher
Java HotSpot(TM) Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Listening for transport dt_socket at address: 9099

最后手動(dòng)修改數(shù)據(jù)庫數(shù)據(jù), 或者等待其他的修改, 再查看一下 rabbitmq 上的監(jiān)控即可知道流程是否走通了.

1.4. 安裝集群 canal

1.4.1. 安裝 canal-admin

1.4.1.1. 下載安裝

下載并解壓縮

sudo wget https://github.com/alibaba/canal/releases/download/canal-1.1.5-alpha-1/canal.admin-1.1.5-SNAPSHOT.tar.gz
sudo tar -zxvf canal.admin-1.1.5-SNAPSHOT.tar.gz

1.4.1.2. 配置文件

application.yml

server:
 port: 8089
spring:
 jackson:
  date-format: yyyy-MM-dd HH:mm:ss
  time-zone: GMT+8

spring.datasource:
 address: 192.168.2.108:3306
 database: canal_manager
 username: canal
 password: canal
 driver-class-name: com.mysql.jdbc.Driver
 # 數(shù)據(jù)庫連接字符串末尾需添加`serverTimezone=UTC`, 否則啟動(dòng)時(shí)會(huì)報(bào)時(shí)區(qū)異常;
 url: jdbc:mysql://${spring.datasource.address}/${spring.datasource.database}?useUnicode=truecharacterEncoding=UTF-8useSSL=falseserverTimezone=UTC
 hikari:
  maximum-pool-size: 30
  minimum-idle: 1

canal:
 # 配置 canal-admin 的管理員賬號(hào)和密碼
 adminUser: admin
 adminPasswd: 123456

canal_manager.sql

在管理canal-admin數(shù)據(jù)的數(shù)據(jù)庫中執(zhí)行該 sql 腳本, 初始化一些表;

1.4.1.3. 啟動(dòng) canal-admin 服務(wù)

Linux 對(duì)應(yīng)的啟動(dòng)腳本 ./bin/startup.sh, Windows 對(duì)應(yīng)的啟動(dòng)腳本 ./bin/startup.bat; 以 Windows 為例:

λ .\startup.bat
start cmd : java  -Xms128m -Xmx512m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dapplication.codeset=UTF-8 -Dfile.encoding=UTF-8 -DappName=canal-admin -classpath "D:\env\green\canal-1.1.5-admin\bin\\..\conf\..\lib\*;D:\env\green\canal-1.1.5-admin\bin\\..\conf" com.alibaba.otter.canal.admin.CanalAdminApplication
2020-04-13 20:01:39.495 [main] INFO com.alibaba.otter.canal.admin.CanalAdminApplication - Starting CanalAdminApplication on Memento-PC with PID 50696 (D:\env\green\canal-1.1.5-admin\lib\canal-admin-server-1.1.5-SNAPSHOT.jar started by Memento in D:\env\green\canal-1.1.5-admin\bin)
2020-04-13 20:01:39.527 [main] INFO com.alibaba.otter.canal.admin.CanalAdminApplication - No active profile set, falling back to default profiles: default
2020-04-13 20:01:39.566 [main] INFO o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@13a5bf6: startup date [Mon Apr 13 20:01:39 CST 2020]; root of context hierarchy
2020-04-13 20:01:41.149 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8089 (http)
2020-04-13 20:01:41.166 [main] INFO org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8089"]
2020-04-13 20:01:41.176 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat]
2020-04-13 20:01:41.177 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/8.5.29
...
2020-04-13 20:01:42.996 [main] INFO org.apache.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8089"]
2020-04-13 20:01:43.007 [main] INFO org.apache.tomcat.util.net.NioSelectorPool - Using a shared selector for servlet write/read
2020-04-13 20:01:43.019 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat started on port(s): 8089 (http) with context path ''
2020-04-13 20:01:43.024 [main] INFO com.alibaba.otter.canal.admin.CanalAdminApplication - Started CanalAdminApplication in 3.919 seconds (JVM running for 5.241)

1.4.1.4. 注意事項(xiàng)

canal-admin 連接數(shù)據(jù)庫的賬號(hào), 必須有建表, 讀寫數(shù)據(jù)的權(quán)限, 如果還是采用上文中創(chuàng)建的 canal 賬號(hào), 需要另外擴(kuò)展一下權(quán)限:

GRANT ALL PRIVILEGES ON *.* TO 'canal'@'%' ;

1.4.2. 添加單機(jī) canal-server 節(jié)點(diǎn)

1.4.2.1. 啟動(dòng) canal-server 節(jié)點(diǎn)服務(wù)

單機(jī) canal-server 照常啟動(dòng), 此時(shí), canal-server 默認(rèn)加載的 ../conf/canal.properties 里的配置信息, 可以從 ../bin/startup.bat[startup.sh] 腳本中獲悉, 獲取從執(zhí)行的腳本命令提示里獲悉;

1.4.2.2. 新建單機(jī) server

canal-admin 中新建一個(gè)單機(jī) server

server 會(huì)自動(dòng)識(shí)別已啟動(dòng)的 canal-server 節(jié)點(diǎn), 但是此時(shí)由 admin 接管后, 不會(huì)自動(dòng)加載 ../conf/canal.properties 的配置文件, 點(diǎn)擊最右側(cè)的 操作-配置 查看, 該 server 加載的是默認(rèn)的配置信息


需要手動(dòng)將 1.3.2 中配置好的 ../conf/canal.properties 里的配置信息拷貝到該配置里進(jìn)行覆蓋!

1.4.2.3. 新建實(shí)例 instance

手動(dòng)在 canal-admin 中新建一個(gè) instance, 對(duì)應(yīng)單機(jī) canal-server 配置下的實(shí)例 example2; 同樣, 需要手動(dòng)將 ./conf/實(shí)例名稱>/instance.properies 配置文件手動(dòng)拷貝到 admin 中

!!注意
在新建或啟動(dòng) instance 實(shí)例時(shí), 先刪除實(shí)例文件夾下的 meta.dat 文件, 并更新 canal.instance.master.journal.name=..., canal.instance.master.position=... 兩個(gè)配置項(xiàng);

1.4.3. 添加集群 canal-server 節(jié)點(diǎn)

1.4.3.1. 新建集群

需要指定集群名稱, 以及配置集群綁定的 zookeeper 集群地址;

新建成功后, 在最右側(cè)的 操作-主配置 中配置集群的通用 server 配置信息

此處也可以將之前配置的 ../conf/canal.properties 配置直接拷貝過來, 稍微修改一下就可以用了

# canal admin config
canal.admin.manager = 192.168.2.108:8089

canal.instance.global.mode = manager

1.4.3.2. 新建 server

指定所屬集群, 為 1.4.3.1 中設(shè)定的集群名稱;

如果先前已經(jīng)啟動(dòng)了 canal-server 節(jié)點(diǎn)服務(wù), 則新建的 server 會(huì)自動(dòng)識(shí)別為 啟動(dòng) 狀態(tài), 否則為 斷開 狀態(tài);

這里有一點(diǎn)需要十分注意的地方

細(xì)心的人可能會(huì)發(fā)現(xiàn), 除了 canal.properties 配置文件, 還有一個(gè) canal_local.properties 的配置文件, 后者比前者的內(nèi)容少了很多, 因?yàn)檫@個(gè)文件就是用于搭建 canal 集群時(shí), 本地節(jié)點(diǎn)的配置文件, 而前者配置文件里的其他信息都是交由 canal-admin 集中配置管理的;

./bin/startup.bat[startup.sh] 啟動(dòng)腳本里, 默認(rèn)是加載 canal.properties 配置文件, 即以單機(jī)形式啟動(dòng)的服務(wù);

windows 在搭建 canal 集群時(shí), 需要手動(dòng)修改 startup.bat, 藍(lán)色標(biāo)注處是加載 %canal_conf% 變量的配置文件路徑, 所以需要將紅色框內(nèi)的變量調(diào)整為:

@rem set canal_conf=...
set canal_conf=%conf_dir%\canal_local.properties

使啟動(dòng)時(shí)加載 canal_local.properties 的配置文件

1.4.3.3. 新建 instance

此處配置也可以基于單機(jī) server 中的實(shí)例 1.4.2.3 配置進(jìn)行調(diào)整使用;

# 2. position info, 指定 mysql 開始同步的 binlog 位置信息
canal.instance.master.address=192.168.0.25:63306
canal.instance.master.journal.name=mysql-bin.001349
canal.instance.master.position=198213313

# 3. username/password, 設(shè)置同步 mysql 的數(shù)據(jù)庫用戶名和密碼
canal.instance.dbUsername=xxxx
canal.instance.dbPassword=xxx

# 4. table regex, 正則匹配需要同步的數(shù)據(jù)表
canal.instance.filter.regex=xxxx

# 5. mq config, 指定 mysql 上的路由綁定, 見 `1.2.3`
canal.mq.topic=example2-routingkey

保存后即可在 操作 中啟動(dòng)該實(shí)例

后話
如果此處的 instance 無法啟動(dòng), 按一下幾個(gè)步驟檢查操作一下試試:

檢查集群里的主配置里的canal.destinations是否包含新建的實(shí)例instance名稱;檢查canal-server節(jié)點(diǎn)是否加載的canal_local.properties配置文件;刪除實(shí)例文件夾下的 .db, .bat 文件, 更新實(shí)例配置文件中的 canal.instance.master.positionbinglog 位置后, 啟動(dòng) instance;

1.5. canal 配置說明

1.5.1. canal.properties

  1. canal.ip, 該節(jié)點(diǎn) IP
  2. canal.register.ip, 注冊(cè)到 zookeeper 上的 IP
  3. canal.zkServers, zk 集群
  4. 是否啟用 tsdb, 開啟 table meta 的時(shí)間序列版本記錄功能
  5. // 5. canal.serverMode, 設(shè)置為 rabbitmq, 默認(rèn)為 tcp
canal.instance.tsdb.enable = true
canal.instance.tsdb.dir = ${canal.file.data.dir:../conf}/${canal.instance.destination:}
canal.instance.tsdb.url = jdbc:h2:${canal.instance.tsdb.dir}/h2;CACHE_SIZE=1000;MODE=MYSQL;
canal.instance.tsdb.dbUsername = canal
canal.instance.tsdb.dbPassword = canal

5.canal.destinations, 當(dāng)前集群上部署的 instance 列表

6.canal.mq.servers, 設(shè)置 Rabbitmq 集群地址, !! 此處不可以加上端口

1.5.2. instance.properties

  1. canal.instance.master.address, master 數(shù)據(jù)庫地址
  2. canal.instance.master.journal.name, 在數(shù)據(jù)庫中執(zhí)行show master status的File值
  3. canal.instance.master.position, 在數(shù)據(jù)庫中執(zhí)行show master status的Position值
  4. canal.instance.tsdb.enable=false, 禁用 tsdb
  5. canal.instance.dbUsername, 實(shí)例數(shù)據(jù)庫用戶名
  6. canal.instance.dbPassword, 實(shí)例數(shù)據(jù)庫密碼
  7. canal.instance.filter.regex, 匹配需要同步的表
  8. canal.mq.topic, canal 注冊(cè) mq 的 topic 名稱

1.5.3. properties 配置文件

properties 配置分為兩部分

canal.properties (系統(tǒng)根配置文件)
instance.properties (instance 級(jí)別的配置文件, 每個(gè)實(shí)例一份)

1.canal.properties

canal.destinations # 當(dāng)前 server 上部署的 instance 列表
canal.conf.dir # conf 目錄所在路徑
canal.auto.scan # 開啟 instance 自動(dòng)掃描
# 如果配置為 true, canal.conf.dir 目錄下的 instance 配置變化會(huì)自動(dòng)觸發(fā)
# 1. instance 目錄新增: 觸發(fā) instance 配置載入, lazy 為 true 時(shí)則自動(dòng)啟動(dòng);
# 2. instance 目錄刪除: 卸載對(duì)應(yīng) instance 配置, 如已啟動(dòng)則進(jìn)行關(guān)閉;
# 3. instance.properties 文件變化: reload instance 配置, 如已啟動(dòng)則自動(dòng)進(jìn)行重啟操作;
canal.auto.scan.interval # instance 自動(dòng)掃描間隔時(shí)間, 單位 s
canal.instance.global.mode # 全局配置加載方式
canal.instance.global.lazy # 全局 lazy 模式
canal.instance.global.manager.address # 全局的 manager 配置方式的鏈接信息
canal.instance.global.spring.xml # 全局的 spring 配置方式的組件文件
canal.instance.example.mode
canal.instance.example.lazy
canal.instance.example.spring.xml
# instance 級(jí)別的配置定義, 如有配置, 會(huì)自動(dòng)覆蓋全局配置定義模式

canal.instance.tsdb.enable # 是否開啟 table meta 的時(shí)間序列版本記錄功能
canal.instance.tsdb.dir # 時(shí)間序列版本的本地存儲(chǔ)路徑, 默認(rèn)為 instance 目錄
canal.instance.tsdb.url # 時(shí)間序列版本的數(shù)據(jù)庫連接地址, 默認(rèn)為本地嵌入式數(shù)據(jù)庫
canal.instance.tsdb.dbUsername # 時(shí)間序列版本的數(shù)據(jù)庫連接賬號(hào)
canal.instance.tsdb.dbPassword # 時(shí)間序列版本的數(shù)據(jù)庫連接密碼

2.instance.properties

canal.id # 每個(gè) canal server 實(shí)例的唯一標(biāo)識(shí)
canal.ip # canal server 綁定的本地 IP 信息, 如果不配置, 默認(rèn)選擇一個(gè)本機(jī) IP 進(jìn)行啟動(dòng)服務(wù)
canal.port # canal server 提供 socket 服務(wù)的端口
canal.zkServers # canal server 連接 zookeeper 集群的連接地址, 例如: 10.20.144.22:2181,10.20.144.23:2181
canal.zookeeper.flush.period # canal 持久化數(shù)據(jù)到 zookeeper 上的更新頻率, 單位 ms
canal.instance.memory.batch.mode # canal 內(nèi)存 store 中數(shù)據(jù)緩存模式
# 1. ITEMSIZE: 根據(jù) buffer.size 進(jìn)行限制, 只限制記錄的數(shù)量
# 2. MEMSIZE: 根據(jù) buffer.size * buffer.memunit 的大小, 限制緩存記錄的大小;
canal.instance.memory.buffer.size # canal 內(nèi)存 store 中可緩存 buffer 記錄數(shù), 需要為 2 的指數(shù)
canal.instance.memory.buffer.memunit # 內(nèi)存記錄的單位大小, 默認(rèn)為 1KB, 和 buffer.size 組合決定最終的內(nèi)存使用大小
canal.instance.transactions.size # 最大事務(wù)完整解析的長(zhǎng)度支持, 超過該長(zhǎng)度后, 一個(gè)事務(wù)可能會(huì)被拆分成多次提交到 canal store 中, 無法保證事務(wù)的完整可見性
canal.instance.fallbackIntervalInSeconds # canal 發(fā)生 mysql 切換時(shí), 在新的 mysql 庫上查找 binlog 時(shí)需要往前查找的時(shí)間, 單位 s
# 說明: mysql 主備庫可能存在解析延遲或者時(shí)鐘不一致, 需要回退一段時(shí)間, 保證數(shù)據(jù)不丟
canal.instance.detecting.enable # 是否開啟心跳檢查
canal.instance.detecting.sql # 心跳檢查 sql, insert into retl.xdual values(1,now()) on duplicate key update x=now()
canal.instance.detecting.interval.time # 心跳檢查頻率, 單位 s
canal.instance.detecting.retry.threshold # 心跳檢查失敗重試次數(shù)
canal.instance.detecting.heatbeatHaEnable # 心跳檢查失敗后, 是否開啟 mysql 自動(dòng)切換
# 說明: 比如心跳檢查失敗超過閾值后, 如果該配置為 true, canal 會(huì)自動(dòng)連到 mysql 備庫獲取 binlog 數(shù)據(jù)
canal.instance.network.receiveBufferSize # 網(wǎng)絡(luò)連接參數(shù), SocketOptions.SO_RCVBUF
canal.instance.network.sendBufferSize # 網(wǎng)絡(luò)連接參數(shù), SocketOptions.SO_SNDBUF
canal.instance.network.soTimeout # 網(wǎng)絡(luò)連接參數(shù), SocketOptions.SO_TIMEOUT

1.5.4. canal.mq.dynamicTopic

參考: https://github.com/alibaba/canal/wiki/Canal-Kafka-RocketMQ-QuickStart?tdsourcetag=s_pctim_aiomsg

1.6. 問題處理

1.windows 下執(zhí)行 startup.bat 啟動(dòng) canal 時(shí), 出現(xiàn)如下異常

Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
ch.qos.logback.core.LogbackException: Unexpected filename extension of file [file:/D:/env/green/canal/conf/]. Should be either .groovy or .xml
        at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:79)
        at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:152)
        at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
        at org.slf4j.impl.StaticLoggerBinder.clinit>(StaticLoggerBinder.java:55)
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:141)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:120)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:331)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:283)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:304)
        at com.alibaba.otter.canal.deployer.CanalLauncher.clinit>(CanalLauncher.java:29)

解決方法:
startup.bat 里的一下這行代碼注釋打開
@rem set logback_configurationFile=%conf_dir%\logback.xml

注, 新版 1.1.5 不存在該問題, 1.1.5這個(gè)文件中的這一行是沒有注釋掉的.

1.1.5新版本 canal-admin 啟動(dòng)時(shí)出現(xiàn)如下異常:

2020-04-10 18:55:40.406 [main] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

解決方法

spring.datasource.url 配置的 mysql 連接地址后面加上參數(shù) serverTimezone=UTC

Instance 日志里出現(xiàn)異常 errno = 1236, sqlstate = HY000 errmsg = log event entry exceeded max_allowed_packet;

2020-04-13 13:06:09.507 [destination = example3 , address = /192.168.2.108:3306 , EventParser] ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:example3[java.io.IOException: Received error packet: errno = 1236, sqlstate = HY000 errmsg = log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the first event 'mysql-5.7' at 671745, the last event read from 'D:\env\mysql-5.7' at 673181, the last byte read from 'D:\env\mysql-5.7' at 673200.
 at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.DirectLogFetcher.fetch(DirectLogFetcher.java:102)
 at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:235)
 at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:265)
 at java.lang.Thread.run(Unknown Source)
]

解決方法

刪除 canal/conf 下對(duì)應(yīng)實(shí)例里的 meta.dat 文件, 讓 canal-admin 自動(dòng)再生成即可;

1.7. 參考資料

canal(基于 mysql 數(shù)據(jù)庫 binlog 的增量訂閱和消費(fèi))

Canal Admin 搭建 Canal 集群以及體驗(yàn)

canal 整合RabbitMQ

canal系列—配置文件介紹

到此這篇關(guān)于mysql-canal-rabbitmq 安裝部署超詳細(xì)教程的文章就介紹到這了,更多相關(guān)mysql-canal-rabbitmq 安裝部署內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • Springboot+rabbitmq實(shí)現(xiàn)延時(shí)隊(duì)列的兩種方式
  • SpringBoot整合RabbitMQ消息隊(duì)列的完整步驟
  • SpringBoot整合RabbitMQ, 實(shí)現(xiàn)生產(chǎn)者與消費(fèi)者的功能
  • 解決SpringMVC項(xiàng)目連接RabbitMQ出錯(cuò)的問題
  • 一篇文章帶你從入門到精通:RabbitMQ

標(biāo)簽:崇左 黃山 衡水 銅川 仙桃 蘭州 湖南 湘潭

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《mysql-canal-rabbitmq 安裝部署超詳細(xì)教程》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    井冈山市| 临武县| 贵德县| 浦县| 桂阳县| 荆门市| 石门县| 高密市| 黑龙江省| 林甸县| 普格县| 南昌县| 友谊县| 安陆市| 山丹县| 高淳县| 彭山县| 石门县| 富源县| 武宣县| 胶州市| 崇义县| 固阳县| 城市| 吴江市| 安徽省| 长汀县| 和平区| 广安市| 光泽县| 昭觉县| 福贡县| 抚州市| 普定县| 土默特右旗| 抚顺市| 理塘县| 安丘市| 慈溪市| 成武县| 龙岩市|