开发者社区> 问答> 正文

canal可以启动,在mysql中也可也可以通过show processlist看见slave进程,

环境信息

canal version canal.deployer-1.1.2 mysql version 5.7.22-log MySQL Community Server (GPL)

问题描述

2019-01-30 15:29:56.124 [main] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [canal.properties] 2019-01-30 15:29:56.129 [main] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [example/instance.properties] 2019-01-30 15:29:56.317 [main] WARN o.s.beans.GenericTypeAwarePropertyDescriptor - Invalid JavaBean property 'connectionCharset' being accessed! Ambiguous write methods found next to actually used [public void com.alibaba.otter.canal.parse.inbound.mysql.AbstractMysqlEventParser.setConnectionCharset(java.lang.String)]: [public void com.alibaba.otter.canal.parse.inbound.mysql.AbstractMysqlEventParser.setConnectionCharset(java.nio.charset.Charset)] 2019-01-30 15:29:56.390 [main] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [canal.properties] 2019-01-30 15:29:56.393 [main] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [example/instance.properties] 2019-01-30 15:29:56.652 [main] ERROR com.alibaba.druid.pool.DruidDataSource - testWhileIdle is true, validationQuery not set 2019-01-30 15:29:56.888 [main] INFO c.a.otter.canal.instance.spring.CanalInstanceWithSpring - start CannalInstance for 1-example 2019-01-30 15:29:56.907 [main] INFO c.a.otter.canal.instance.core.AbstractCanalInstance - start successful.... 2019-01-30 15:29:57.008 [destination = example , address = /127.0.0.1:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ---> begin to find start position, it will be long time for reset or first position 2019-01-30 15:29:57.331 [destination = example , address = /127.0.0.1:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - prepare to find start position log-bin.000001:7577:1548832204000 2019-01-30 15:29:58.207 [destination = example , address = /127.0.0.1:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ---> find start position successfully, EntryPosition[included=false,journalName=log-bin.000001,position=7577,serverId=139,gtid=,timestamp=1548832204000] cost : 1179ms , the next step is binlog dump

步骤重现

mysql从processlist看,可以看到canal已经连接上了 mysql> show processlist; +-----+-------+-----------------+------+-------------+------+---------------------------------------------------------------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +-----+-------+-----------------+------+-------------+------+---------------------------------------------------------------+------------------+ | 720 | root | localhost | xykj | Query | 0 | starting | show processlist | | 721 | canal | localhost:36942 | NULL | Sleep | 175 | | NULL | | 725 | canal | localhost:36946 | NULL | Binlog Dump | 174 | Master has sent all binlog to slave; waiting for more updates | NULL | +-----+-------+-----------------+------+-------------+------+---------------------------------------------------------------+------------------+ 3 rows in set (0.00 sec)

mysql>

conf/canal.properties 修改点为:

cat canal.properties | grep canal.ip

canal.ip = 192.168.31.139

conf/example/instance.properties修改的点为:

mysql serverId , v1.0.26+ will autoGen

canal.instance.mysql.slaveId=234

position info

canal.instance.master.address=127.0.0.1:3306 canal.instance.master.journal.name=log-bin.000001 canal.instance.master.position=7923 canal.instance.master.timestamp= canal.instance.master.gtid=

username/password

canal.instance.dbUsername=canal canal.instance.dbPassword=canal canal.instance.connectionCharset = UTF-8 canal.instance.defaultDatabaseName =canal

conf/canal.properties 完整conf

cat canal.properties

################################################# ######### common argument ############# ################################################# canal.id = 1 canal.ip = 192.168.31.139 canal.port = 11111 canal.metrics.pull.port = 11112 canal.zkServers =

flush data to zk

canal.zookeeper.flush.period = 1000 canal.withoutNetty = false

tcp, kafka, RocketMQ

canal.serverMode = tcp

flush meta cursor/parse position to file

canal.file.data.dir = ${canal.conf.dir} canal.file.flush.period = 1000

memory store RingBuffer size, should be Math.pow(2,n)

canal.instance.memory.buffer.size = 16384

memory store RingBuffer used memory unit size , default 1kb

canal.instance.memory.buffer.memunit = 1024

meory store gets mode used MEMSIZE or ITEMSIZE

canal.instance.memory.batch.mode = MEMSIZE canal.instance.memory.rawEntry = true

detecing config

canal.instance.detecting.enable = false #canal.instance.detecting.sql = insert into retl.xdual values(1,now()) on duplicate key update x=now() canal.instance.detecting.sql = select 1 canal.instance.detecting.interval.time = 3 canal.instance.detecting.retry.threshold = 3 canal.instance.detecting.heartbeatHaEnable = false

support maximum transaction size, more than the size of the transaction will be cut into multiple transactions delivery

canal.instance.transaction.size = 1024

mysql fallback connected to new master should fallback times

canal.instance.fallbackIntervalInSeconds = 60

network config

canal.instance.network.receiveBufferSize = 16384 canal.instance.network.sendBufferSize = 16384 canal.instance.network.soTimeout = 30

binlog filter config

canal.instance.filter.druid.ddl = true canal.instance.filter.query.dcl = false canal.instance.filter.query.dml = false canal.instance.filter.query.ddl = false canal.instance.filter.table.error = false canal.instance.filter.rows = false canal.instance.filter.transaction.entry = false

binlog format/image check

canal.instance.binlog.format = ROW,STATEMENT,MIXED canal.instance.binlog.image = FULL,MINIMAL,NOBLOB

binlog ddl isolation

canal.instance.get.ddl.isolation = false

parallel parser config

canal.instance.parser.parallel = true

concurrent thread number, default 60% available processors, suggest not to exceed Runtime.getRuntime().availableProcessors()

#canal.instance.parser.parallelThreadSize = 16

disruptor ringbuffer size, must be power of 2

canal.instance.parser.parallelBufferSize = 256

table meta tsdb info

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

dump snapshot interval, default 24 hour

canal.instance.tsdb.snapshot.interval = 24

purge snapshot expire , default 360 hour(15 days)

canal.instance.tsdb.snapshot.expire = 360

aliyun ak/sk , support rds/mq

canal.aliyun.accesskey = canal.aliyun.secretkey =

################################################# ######### destinations ############# ################################################# canal.destinations = example

conf root dir

canal.conf.dir = ../conf

auto scan instance dir add/remove and start/stop instance

canal.auto.scan = true canal.auto.scan.interval = 5

canal.instance.tsdb.spring.xml = classpath:spring/tsdb/h2-tsdb.xml #canal.instance.tsdb.spring.xml = classpath:spring/tsdb/mysql-tsdb.xml

canal.instance.global.mode = spring canal.instance.global.lazy = false #canal.instance.global.manager.address = 127.0.0.1:1099 #canal.instance.global.spring.xml = classpath:spring/memory-instance.xml canal.instance.global.spring.xml = classpath:spring/file-instance.xml #canal.instance.global.spring.xml = classpath:spring/default-instance.xml

################################################## ######### MQ ############# ################################################## canal.mq.servers = 127.0.0.1:6667 canal.mq.retries = 0 canal.mq.batchSize = 16384 canal.mq.maxRequestSize = 1048576 canal.mq.lingerMs = 1 canal.mq.bufferMemory = 33554432 canal.mq.canalBatchSize = 50 canal.mq.canalGetTimeout = 100 canal.mq.flatMessage = true canal.mq.compressionType = none canal.mq.acks = all

conf/example/instance.properties完整conf

cat instance.properties

#################################################

mysql serverId , v1.0.26+ will autoGen

canal.instance.mysql.slaveId=234

enable gtid use true/false

canal.instance.gtidon=false

position info

canal.instance.master.address=127.0.0.1:3306 canal.instance.master.journal.name=log-bin.000001 canal.instance.master.position=7923 canal.instance.master.timestamp= canal.instance.master.gtid=

rds oss binlog

canal.instance.rds.accesskey= canal.instance.rds.secretkey= canal.instance.rds.instanceId=

table meta tsdb info

canal.instance.tsdb.enable=true #canal.instance.tsdb.url=jdbc:mysql://127.0.0.1:3306/canal_tsdb #canal.instance.tsdb.dbUsername=canal #canal.instance.tsdb.dbPassword=canal

#canal.instance.standby.address = #canal.instance.standby.journal.name = #canal.instance.standby.position = #canal.instance.standby.timestamp = #canal.instance.standby.gtid=

username/password

canal.instance.dbUsername=canal canal.instance.dbPassword=canal canal.instance.connectionCharset = UTF-8 canal.instance.defaultDatabaseName =canal

enable druid Decrypt database password

canal.instance.enableDruid=false #canal.instance.pwdPublicKey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALK4BUxdDltRRE5/zXpVEVPUgunvscYFtEip3pmLlhrWpacX7y7GCMo2/JM6LeHmiiNdH1FWgGCpUfircSwlWKUCAwEAAQ==

table regex

canal.instance.filter.regex=.\..

table black regex

canal.instance.filter.black.regex=

mq config

canal.mq.topic=example canal.mq.partition=0

hash partition config

#canal.mq.partitionsNum=3 #canal.mq.partitionHash=mytest.person:id,mytest.role:id #################################################

原提问者GitHub用户pdudo

展开
收起
古拉古拉 2023-05-08 14:48:08 104 0
2 条回答
写回答
取消 提交回答
  • at java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1314),这个报错应该是cpu为1导致

    cpu为1无法使用的问题,在1.1.3-alpha-3版本里做了修复

    原回答者GitHub用户agapple

    2023-05-09 18:00:18
    赞同 展开评论 打赏
  • 初步判断问题可能是由于 Canal Server 配置文件存在一些问题导致的。

    具体而言,错误信息中提到了 Invalid JavaBean property 'connectionCharset' being accessed,这意味着 Canal Server 在加载配置文件时,遇到了无效的配置项。这些无效的配置可能来自于 canal.properties 或者 instance.properties 文件。

    针对这个问题,您可以尝试以下解决方法:

    检查 canal.properties 和 instance.properties 文件中的配置项,确认是否存在错误的配置。特别注意,如果您使用的是 Canal 1.1.2 版本,那么 connectionCharset 配置项是无效的,应该使用 charset 配置项来设置字符集编码。请检查这个配置项以及其他可能存在问题的配置项,并将其修改为正确的值。

    确认 Canal Server 版本是否与您使用的 MySQL 版本兼容。Canal 1.1.2 可以支持 MySQL 5.7 版本,但是在使用其他版本的 MySQL 时可能会出现异常。建议您使用最新版本的 Canal Server,并按照官方文档指导进行配置和安装。

    如果以上两种方法都无法解决问题,您可以尝试通过升级 Spring Framework 的版本来解决问题。错误信息中提到了 GenericTypeAwarePropertyDescriptor,这是 Spring Framework 中的一个类,可能与 Canal Server 的版本不兼容。升级到最新版本的 Spring Framework 可以帮助您解决此问题。

    2023-05-08 15:33:05
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
PolarDB MySQL引擎重磅功能及产品能力盛大发布 立即下载
服务上云加速大家居产业C2M进程 立即下载
阿里云MySQL云数据库产品体系介绍 立即下载

相关镜像