tungsten-replicator问题与解决方法

最近使用tungsten-replicator同步mysql的数据到mongodb,期间遇到不少错误,记录一下解决方法。

tungsten-replicator在执行tpm install时默认会打日志在/tmp/tungsten-configure.log,如果安装时出问题可以查看这个日志。

一、 What type of mechanism is used to control the startup and shutdown of system services

执行tpm install的时候出这个错,查看日志/tmp/tungsten-configure.log发现这样的错误:

tungsten-replicator问题与解决方法_第1张图片

解决方法:原来是service不在/sbin目录下,在把/usr/sbin加入到环境变量PATH里就行了。

二、host问题

在运行tpm install的时候会检查host文件,执行replicator start时也会检查。

要保证/etc/hosts文件里有ip地址和hostname的对应关系。

三、mysql的权限问题

要保证配置的ip地址、mysql用户名密码可以登录到mysql。

四、Network download of binlog failed; may indicated that MySQL terminated the connection

master的tungsten replicator出现这个问题,具体的日志如下:

2016-11-28 17:52:00,009 [Relay Client - alpha] INFO  MySQLPacket Paused to allow packet data to appear on the network: delay=30.001 timeout=30.0 packetNumber=55 packetlen=87 bytesRead=41
2016-11-28 17:52:00,009 [Relay Client - alpha] ERROR MySQLPacket I/O error while reading from client socket
java.io.EOFException: Reached end of input stream: packetNumber=55 packetlen=87 bytesRead=41
        at com.continuent.tungsten.common.mysql.MySQLPacket.readPacket(MySQLPacket.java:306)
        at com.continuent.tungsten.replicator.extractor.mysql.RelayLogClient.processEvent(RelayLogClient.java:466)
        at com.continuent.tungsten.replicator.extractor.mysql.RelayLogTask.run(RelayLogTask.java:58)
        at java.lang.Thread.run(Thread.java:745)
2016-11-28 17:52:00,009 [Relay Client - alpha] ERROR RelayLogTask Relay log task failed due to exception: Network download of binlog failed; may indicated that MySQL terminated the connection.  Check your serve
rID setting!
com.continuent.tungsten.replicator.extractor.ExtractorException: Network download of binlog failed; may indicated that MySQL terminated the connection.  Check your serverID setting!
        at com.continuent.tungsten.replicator.extractor.mysql.RelayLogTask.run(RelayLogTask.java:67)
        at java.lang.Thread.run(Thread.java:745)

查看了出现问题的binlog的位置,当前的事务较大,一条mysql命令删除了几十万条数据。 问题主要出在relay client,看了tungsten replicator的代码和一些博客,发现tungsten replicator默认会通过dump binlog的方式下载binlog,这个过程在tungsten replicator中叫做relay log,并不是直接去读取mysql的binlog日志文件。所以获取这条事务的binlog时数据量较大,会造成和mysql的连接出现问题。需要修改配置,修改conf/static-[服务名].properties,设置replicator.extractor.dbms.useRelayLogs=true,重启服务后就会读取binlog日志文件。


还有其他一些问题,以后再更新。

你可能感兴趣的:(数据库)