开发者社区 > 数据库 > 关系型数据库 > 正文

阿里云 rds 字符集 utf8mb4 从 oss 无法下载 rds 备份 Binlog 报 Cou

从阿里云 rds 主库获取 binlog,过一段时间之后开始报以下错误。已设置在 accesskey 和 secret 从 oss 下载旧 binlog,但日志显示已找到 binlog 开始 binlog dump 后不成功。rds 的 mysql 版本是 5.7, character_set_connection 是 utf8mb4,如果把 canal.instance.connectionCharset = UTF-8 设置为 canal.instance.connectionCharset = utf8mb4 则 example.log 会报错。

2020-07-06 13:31:37.259 [destination = example , address = mysqlhostname/rds-ip: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
2020-07-06 13:31:37.259 [destination = example , address = mysqlhostname/rds-ip:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - prepare to find start position mysql-bin.001977:4:1593776931000
2020-07-06 13:31:37.260 [destination = example , address = mysqlhostname/rds-ip:3306 , EventParser] WARN c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ---> find start position successfully, EntryPosition[included=false,journalName=mysql-bin.001977,position=4,serverId=,gtid=,timestamp=1593776931000] cost : 1ms , the next step is binlog dump
2020-07-06 13:31:37.275 [destination = example , address = mysqlhostname/rds-ip:3306 , EventParser] ERROR c.a.o.canal.parse.inbound.mysql.dbsync.DirectLogFetcher - I/O error while reading from client socket
java.io.IOException: Received error packet: errno = 1236, sqlstate = HY000 errmsg = Could not find first log file name in binary log index file
at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.DirectLogFetcher.fetch(DirectLogFetcher.java:102) ~[canal.parse-1.1.4.jar:na]
at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:235) [canal.parse-1.1.4.jar:na]
at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:265) [canal.parse-1.1.4.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
2020-07-06 13:31:37.275 [destination = example , address = mysqlhostname/rds-ip:3306 , EventParser] ERROR c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - dump address mysqlhostname/rds-ip:3306 has an error, retrying. caused by
java.io.IOException: Received error packet: errno = 1236, sqlstate = HY000 errmsg = Could not find first log file name in binary log index file
at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.DirectLogFetcher.fetch(DirectLogFetcher.java:102) ~[canal.parse-1.1.4.jar:na]
at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:235) ~[canal.parse-1.1.4.jar:na]
at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:265) ~[canal.parse-1.1.4.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
2020-07-06 13:31:37.275 [destination = example , address = mysqlhostname/rds-ip:3306 , EventParser] ERROR com.alibaba.otter.canal.common.alarm.LogAlarmHandler - destination:example[java.io.IOException: Received error packet: errno = 1236, sqlstate = HY000 errmsg = Could not find first log file name in binary log index file
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(Thread.java:748)

canal.instance.connectionCharset = utf8mb4 报错

2020-07-06 13:47:01.380 [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)]
2020-07-06 13:47:01.451 [main] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [canal.properties]
2020-07-06 13:47:01.452 [main] INFO c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [example/instance.properties]
2020-07-06 13:47:01.853 [main] WARN o.s.context.support.ClassPathXmlApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'instance' defined in class path resource [spring/file-instance.xml]: Cannot resolve reference to bean 'eventParser' while setting bean property 'eventParser'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventParser' defined in class path resource [spring/file-instance.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connectionCharset' threw exception; nested exception is java.nio.charset.UnsupportedCharsetException: utf8mb4
2020-07-06 13:47:01.857 [main] ERROR c.a.o.canal.instance.spring.SpringCanalInstanceGenerator - generator instance failed.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'instance' defined in class path resource [spring/file-instance.xml]: Cannot resolve reference to bean 'eventParser' while setting bean property 'eventParser'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventParser' defined in class path resource [spring/file-instance.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connectionCharset' threw exception; nested exception is java.nio.charset.UnsupportedCharsetException: utf8mb4
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:638) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942) ~[spring-context-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) ~[spring-context-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) ~[spring-context-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) ~[spring-context-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at com.alibaba.otter.canal.instance.spring.SpringCanalInstanceGenerator.getBeanFactory(SpringCanalInstanceGenerator.java:46) ~[canal.instance.spring-1.1.4.jar:na]
at com.alibaba.otter.canal.instance.spring.SpringCanalInstanceGenerator.generate(SpringCanalInstanceGenerator.java:29) ~[canal.instance.spring-1.1.4.jar:na]
at com.alibaba.otter.canal.deployer.CanalController$5.generate(CanalController.java:392) [canal.deployer-1.1.4.jar:na]
at com.alibaba.otter.canal.server.embedded.CanalServerWithEmbedded$1.apply(CanalServerWithEmbedded.java:85) [canal.server-1.1.4.jar:na]
at com.alibaba.otter.canal.server.embedded.CanalServerWithEmbedded$1.apply(CanalServerWithEmbedded.java:82) [canal.server-1.1.4.jar:na]
at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:356) [guava-18.0.jar:na]
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:182) [guava-18.0.jar:na]
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:151) [guava-18.0.jar:na]
at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:67) [guava-18.0.jar:na]
at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:885) [guava-18.0.jar:na]
at com.alibaba.otter.canal.server.embedded.CanalServerWithEmbedded.start(CanalServerWithEmbedded.java:137) [canal.server-1.1.4.jar:na]
at com.alibaba.otter.canal.deployer.CanalController$2$1.processActiveEnter(CanalController.java:160) [canal.deployer-1.1.4.jar:na]
at com.alibaba.otter.canal.common.zookeeper.running.ServerRunningMonitor.processActiveEnter(ServerRunningMonitor.java:247) [canal.common-1.1.4.jar:na]
at com.alibaba.otter.canal.common.zookeeper.running.ServerRunningMonitor.start(ServerRunningMonitor.java:104) [canal.common-1.1.4.jar:na]
at com.alibaba.otter.canal.deployer.CanalController.start(CanalController.java:513) [canal.deployer-1.1.4.jar:na]
at com.alibaba.otter.canal.deployer.CanalStarter.start(CanalStarter.java:78) [canal.deployer-1.1.4.jar:na]
at com.alibaba.otter.canal.deployer.CanalLauncher.main(CanalLauncher.java:115) [canal.deployer-1.1.4.jar:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventParser' defined in class path resource [spring/file-instance.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connectionCharset' threw exception; nested exception is java.nio.charset.UnsupportedCharsetException: utf8mb4
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1455) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
... 31 common frames omitted
Caused by: org.springframework.beans.PropertyBatchUpdateException: Failed properties: Property 'connectionCharset' threw exception; nested exception is java.nio.charset.UnsupportedCharsetException: utf8mb4
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:101) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1452) ~[spring-beans-3.2.18.RELEASE.jar:3.2.18.RELEASE]

原提问者GitHub用户dearxuany

展开
收起
Java工程师 2023-05-03 09:42:39 256 0
1 条回答
写回答
取消 提交回答
  • java里是不支持utf8mb4,可以使用utf8代替

    原回答者GitHub用户agapple

    2023-05-04 13:29:10
    赞同 展开评论 打赏

阿里云关系型数据库主要有以下几种:RDS MySQL版、RDS PostgreSQL 版、RDS SQL Server 版、PolarDB MySQL版、PolarDB PostgreSQL 版、PolarDB分布式版 。

相关产品

  • 云数据库 RDS MySQL 版
  • 云数据库 RDS
  • 相关电子书

    更多
    OSS运维进阶实战手册 立即下载
    《OSS运维基础实战手册》 立即下载
    OSS运维基础实战手册 立即下载

    相关镜像