fixed issue #284 , add slave_uuid

This commit is contained in:
agapple
2017-04-01 21:01:07 +08:00
parent e5444ae658
commit b2a5f482ee

View File

@@ -213,6 +213,16 @@ public class MysqlConnection implements ErosaConnection {
} }
} }
try {
// 参考:https://github.com/alibaba/canal/issues/284
// mysql5.6需要设置slave_uuid避免被server kill链接
update("set @slave_uuid=uuid()");
} catch (Exception e) {
if (!StringUtils.contains(e.getMessage(), "Unknown system variable")) {
logger.warn(ExceptionUtils.getFullStackTrace(e));
}
}
try { try {
// mariadb针对特殊的类型,需要设置session变量 // mariadb针对特殊的类型,需要设置session变量
update("SET @mariadb_slave_capability='" + LogEvent.MARIA_SLAVE_CAPABILITY_MINE + "'"); update("SET @mariadb_slave_capability='" + LogEvent.MARIA_SLAVE_CAPABILITY_MINE + "'");