一、binlog文件被清理:Could not find first log file name in binary log index file
1.报错日志
2.现象
如下图所示,pipeline的mainstem状态 一直处于定位中状态
3.问题排查
一般出现这个报错,都是由于运维同学误清空数据库binlog文件导致,我们按下述步骤确定是否由于binlog文件被清理:
首先,查看当前同步的binlog位点:
其次:登录数据库查看binlog文件信息(查询sql为:show master logs;):
通过上述比对,发现数据库的binlog被清理掉了,被清理前,otter标记的位点为mysql-bin.000245这个文件,被清理后,mysql重新从1开始生成binlog文件导致otter同步失败
4.处理办法:
1.清空掉otter的同步信息
2.检查canal的同步位点配置
3.重新启动otter同步
1.报错日志
无报错日志
2.现象
channel状态正常,mainstem状态也是工作中,但是position信息里,position的信息一直不更新(超过半小时以上)
3.确认是否为大事务的方法
首先,登录对应仓库的数据库,先查询当前数据库的binlog文件跑到哪里了
查询sql为 show master logs;
然后查询position信息里卡住的binlog文件信息,判断是否产生了大事务
查询sql为show binlog events in '你要查询的binlog名称';(例如:show binlog events in 'mysql-bin.000235';)
(下图为查询mysql-bin.000235这个binlog文件,发现由于源库做切表处理,产生了大事务)
4.解决方法
从我们卡住的位点,依次往后面查询binlog,找到这个大事务终结的位点。然后手动更新canal的位点信息,删除同步记录,然后重启channel
a.清空掉otter的同步信息
b.检查canal的同步位点配置
c.重新启动otter同步
三、node内存溢出:java.lang.OutOfMemoryError: unable to create new native thread
1.报错日志
2.现象
node节点均为运行中状态,但是涉及到问题node的channel的同步均处于挂起状态,且无法解挂及停止
3.问题排查
一般出现这个报错,基本上都是node服务器上内存溢出,会导致我们一些操作无法执行
首先,根据报错log上的nid找到对应的node
其次:尝试登录node服务器,看是否能重启node
如果服务器也无法登陆,说明是服务器挂掉了,问题基本上明了了
如果服务器可以登陆,尝试重启node服务
4.处理办法:
联系运拥有阿里云服务器权限的运维同事,帮忙重启对应的服务器
四、node节点挂掉
1.现象
Channel配置显示为挂起或者停止状态,并且启动或者解挂操作为置灰不可操作。可以判定为node节点挂掉了
2.排查
进入node管理页面,查看是否有node节点状态处于未启动状态
3.解决方法
根据挂掉的node节点,登录对应的服务器,进行node服务的重启操作
登录服务器后,输入停止node服务命令
sh /usr/local/geekplus/software/node.deployer-4.2.16/bin/stop.sh
待node服务关闭后,输入node服务启动命令
sh /usr/local/geekplus/software/node.deployer-4.2.16/bin/start.sh
重启完node后,进入otter主页面进行channel的解挂或者启动操作(http://10.44.50.248:21000 用户名/密码:admin/admin
监控日志中有类似以下内容时:检查从阿里云上是否能访问到数据库ip,ping是否通,不通可能是现场的vpn断了,找网络运维恢复。如果ping是通的,尝试停止同步后恢复。
pid:14 nid:1 exception:canal:dataplatform-成都主库-业务数据:com.alibaba.otter.canal.parse.exception.CanalParseException: java.io.IOException: connect /192.168.116.16:3306 failure
Caused by: java.io.IOException: connect /192.168.116.16:3306 failure
at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector.connect(MysqlConnector.java:77)
at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.connect(MysqlConnection.java:86)
at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.preDump(MysqlEventParser.java:85)
at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:175)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at com.alibaba.otter.canal.parse.driver.mysql.socket.BioSocketChannelPool.open(BioSocketChannelPool.java:18)
at com.alibaba.otter.canal.parse.driver.mysql.socket.SocketChannelPool.open(SocketChannelPool.java:18)
at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector.connect(MysqlConnector.java:72)
... 4 more
pid:10 nid:1 exception:setl:com.alibaba.otter.node.etl.select.exceptions.SelectException: com.google.common.collect.ComputationException: org.apache.commons.lang.exception.NestableRuntimeException: find table [wms.t_pick_wave_detail] error
at com.alibaba.otter.node.etl.select.selector.MessageParser.parse(MessageParser.java:211)
at com.alibaba.otter.node.etl.select.selector.canal.CanalEmbedSelector.selector(CanalEmbedSelector.java:308)
at com.alibaba.otter.node.etl.select.SelectTask.processSelect(SelectTask.java:236)
at com.alibaba.otter.node.etl.select.SelectTask.access$300(SelectTask.java:94)
at com.alibaba.otter.node.etl.select.SelectTask$1.run(SelectTask.java:208)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.google.common.collect.ComputationException: org.apache.commons.lang.exception.NestableRuntimeException: find table [wms.t_pick_wave_detail] error
at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:889)
at com.alibaba.otter.node.etl.common.db.dialect.AbstractDbDialect.findTable(AbstractDbDialect.java:109)
at com.alibaba.otter.node.etl.common.db.dialect.AbstractDbDialect.findTable(AbstractDbDialect.java:113)
at com.alibaba.otter.node.etl.select.selector.MessageParser.internParse(MessageParser.java:434)
at com.alibaba.otter.node.etl.select.selector.MessageParser.internParse(MessageParser.java:390)
at com.alibaba.otter.node.etl.select.selector.MessageParser.parse(MessageParser.java:183)
... 9 more
Caused by: org.apache.commons.lang.exception.NestableRuntimeException: find table [wms.t_pick_wave_detail] error
at com.alibaba.otter.node.etl.common.db.dialect.AbstractDbDialect$2.apply(AbstractDbDialect.java:188)
at com.alibaba.otter.node.etl.common.db.dialect.AbstractDbDialect$2.apply(AbstractDbDialect.java:172)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:356)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:182)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:151)
at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:67)
at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:885)
... 14 more
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:331)
at com.alibaba.otter.shared.common.utils.meta.DdlUtils.findTable(DdlUtils.java:120)
at com.alibaba.otter.node.etl.common.db.dialect.AbstractDbDialect$2.apply(AbstractDbDialect.java:179)
... 20 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.GeneratedConstructorAccessor134.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2251)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.GeneratedConstructorAccessor28.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)
at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
... 23 more
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
... 42 more
生产环境下,偶尔会因为主备设置或者ip规划导致需要更改同步的数据源ip。以大兴仓变更数据源ip为例,处理方法如下
1.停止同步
2.记录binlog的同步进度,binlog文件名journamName和位点信息position
3.点击大兴仓channel,进入pipeline管理页面
4.点击canal名字,进入到此同步的canal配置中,然后点击编辑,进行ip的修改()
4.点击菜单栏的配置管理-数据源配置,进入数据源配置页面,找到对应的数据源,点击编辑进行数据源ip的修改
5.删除当前同步记录的位点信息,然后启动同步
6.观察同步是否有异常,若有,根据报错信息进行对应的处理