环境信息
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 修改点为:
canal.ip = 192.168.31.139
conf/example/instance.properties修改的点为:
canal.instance.mysql.slaveId=234
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=
canal.instance.dbUsername=canal canal.instance.dbPassword=canal canal.instance.connectionCharset = UTF-8 canal.instance.defaultDatabaseName =canal
conf/canal.properties 完整conf
################################################# ######### common argument ############# ################################################# canal.id = 1 canal.ip = 192.168.31.139 canal.port = 11111 canal.metrics.pull.port = 11112 canal.zkServers =
canal.zookeeper.flush.period = 1000 canal.withoutNetty = false
canal.serverMode = tcp
canal.file.data.dir = ${canal.conf.dir} canal.file.flush.period = 1000
canal.instance.memory.buffer.size = 16384
canal.instance.memory.buffer.memunit = 1024
canal.instance.memory.batch.mode = MEMSIZE canal.instance.memory.rawEntry = true
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
canal.instance.transaction.size = 1024
canal.instance.fallbackIntervalInSeconds = 60
canal.instance.network.receiveBufferSize = 16384 canal.instance.network.sendBufferSize = 16384 canal.instance.network.soTimeout = 30
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
canal.instance.binlog.format = ROW,STATEMENT,MIXED canal.instance.binlog.image = FULL,MINIMAL,NOBLOB
canal.instance.get.ddl.isolation = false
canal.instance.parser.parallel = true
#canal.instance.parser.parallelThreadSize = 16
canal.instance.parser.parallelBufferSize = 256
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
canal.instance.tsdb.snapshot.interval = 24
canal.instance.tsdb.snapshot.expire = 360
canal.aliyun.accesskey = canal.aliyun.secretkey =
################################################# ######### destinations ############# ################################################# canal.destinations = example
canal.conf.dir = ../conf
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
#################################################
canal.instance.mysql.slaveId=234
canal.instance.gtidon=false
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=
canal.instance.rds.accesskey= canal.instance.rds.secretkey= canal.instance.rds.instanceId=
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=
canal.instance.dbUsername=canal canal.instance.dbPassword=canal canal.instance.connectionCharset = UTF-8 canal.instance.defaultDatabaseName =canal
canal.instance.enableDruid=false #canal.instance.pwdPublicKey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALK4BUxdDltRRE5/zXpVEVPUgunvscYFtEip3pmLlhrWpacX7y7GCMo2/JM6LeHmiiNdH1FWgGCpUfircSwlWKUCAwEAAQ==
canal.instance.filter.regex=.\..
canal.instance.filter.black.regex=
canal.mq.topic=example canal.mq.partition=0
#canal.mq.partitionsNum=3 #canal.mq.partitionHash=mytest.person:id,mytest.role:id #################################################
原提问者GitHub用户pdudo
at java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1314),这个报错应该是cpu为1导致
cpu为1无法使用的问题,在1.1.3-alpha-3版本里做了修复
原回答者GitHub用户agapple
初步判断问题可能是由于 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 可以帮助您解决此问题。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。