使用 Attunity Replicate MSM 将数据从 RDS MySQL 迁移到 MySQL 的 Azure 数据库时,迁移任务在 'load data local infile' 失败

Migration task failed at 'load data local infile' while migrating the data from RDS MySQL to Azure Database for MySQL using Attunity Replicate MSM

我尝试使用 'Attunity Replicate for Microsoft Migrations(Replicate MSM)'。
为此,我在本地 Windows 10 机器上设置了 Replicate MSM 工具,然后定义并测试源和目标数据库端点,例如。 RDS 作为源,Azure 作为目标,安装所需的 mysql、odbc 驱动程序并在两个数据库上启用二进制日志记录和 local-infile 参数。但是现在当我 运行 迁移任务时,它只在目标数据库上创建迁移表的模式,并在 'load data local infile' 命令中失败。 这是堆栈跟踪:

00014468: 2019-06-20T11:17:41 [SOURCE_UNLOAD   ]I:  Unload finished for table 'TestDb'.'Employee' (Id = 1). 2000 rows sent.  (streamcomponent.c:2892)
00014968: 2019-06-20T11:17:41 [TARGET_LOAD     ]I:  Loading table 'migrationtesting'.'Employee' with parallel threads  (odbc_endpoint_imp.c:5256)
00014968: 2019-06-20T11:17:41 [TARGET_LOAD     ]I:  Use parallel load thread pool with '3' threads  (csv_target.c:280)
00014968: 2019-06-20T11:17:42 [TARGET_LOAD     ]I:  Load finished for table 'TestDb'.'Employee' (Id = 1). 2000 rows received. 0 rows skipped. Volume transfered 904960  (streamcomponent.c:3116)
00014968: 2019-06-20T11:17:43 [TARGET_LOAD     ]E:  Failed to execute statement: 'load data local infile "C:\Program Files\Attunity\ReplicateMSM\data\tasks\Aws2Azure\data_files\1\LOAD00000001.csv" into table `migrationtesting`.`Employee` CHARACTER SET UTF8 fields terminated by ','  enclosed by '"' lines terminated by '\n'( `id`,`name`,`gender`,`mobile`,`city` ) ;' [1022502]  (ar_odbc_stmt.c:4349)
00014968: 2019-06-20T11:17:43 [TARGET_LOAD     ]E:  RetCode: SQL_ERROR  SqlState: HY000 NativeError: 1148 Message: [MySQL][ODBC 5.3(w) Driver][mysqld-5.6.39.0]The used command is not allowed with this MySQL version [1022502]  (ar_odbc_stmt.c:4355)
00007376: 2019-06-20T11:17:43 [TASK_MANAGER    ]W:  Table 'TestDb'.'Employee' (subtask 1 thread 1) is suspended  (replicationtask.c:2050)
00014968: 2019-06-20T11:17:43 [TARGET_LOAD     ]E:  Failed to start load process for file '1' [1022502]  (csv_target.c:1350)
00007376: 2019-06-20T11:17:43 [TASK_MANAGER    ]I:  All tables are loaded. Full load only task is stopped  (replicationtask.c:2992)
00014968: 2019-06-20T11:17:43 [TARGET_LOAD     ]E:  Failed to load file '1' [1022502]  (csv_target.c:1418)
00014968: 2019-06-20T11:17:43 [TARGET_LOAD     ]E:  Failed to load data from csv file. [1022502]  (odbc_endpoint_imp.c:5331)

根据 Azure 文档:

LOAD DATA INFILE is supported, but the [LOCAL] parameter must be specified and directed to a UNC path (Azure storage mounted through SMB).

如果这是解决方案,请解释如何实施。

注意:MySQLRDS 和 AZURE 上的服务器版本均为 5.6

由于错误日志表明您正在使用 v5.3 的 MySQL ODBC 驱动程序,其中 LOAD DATA INFILE 功能默认处于禁用状态,以启用为此,我们需要将 ENABLE_LOCAL_INFILE 的值显式设置为 1。 在用于 Microsoft 迁移的 Attunity Replicate 中,您必须为 Target 数据库端点启用此标志,您可以按照以下步骤启用它...

  • Open the settings of target Endpoint.

  • Goto Advanced tab > Internal Parameters.

  • Add search key additionalConnectionProperties and hit Enter. (it's case-sensitive,so just copy/paste the same)

  • You can see a new key has been created under internal parameters, type the value for this newly created key as: ENABLE_LOCAL_INFILE=1;

  • Save and then Reload your task.

致谢: Microsoft Migrations 的官方 Attunity Community/Support 团队