Data Mover 支持在 Teradata Database 和 Hadoop 之间使用 TDCH 或 QueryGrid 复制表。在 Teradata 和 Hadoop 之间复制数据类似于在 Teradata 系统之间复制数据,两者的区别在于,当用户从 Teradata 复制到 Hadoop 并将 overwrite_existing_objects 设置为 false,并且目标表存在时,Data Mover 会将部分数据追加到现有的 Hive 表中,不会从表中删除任何行。将不会使用 DELETE/INSERT、UPDATE 和 MERGE 函数。
QueryGrid 和 TDCH 都支持在 Teradata 和 Hadoop 之间复制部分表。QueryGrid 支持在 Teradata 和 Hadoop 之间复制部分表。TDCH 支持将部分表从 Teradata 复制到 Hadoop,但不支持从 Hadoop 复制到 Teradata。当 TDCH 用于将部分表从 Hadoop 复制到 Teradata 时,Data Mover 会将整个表复制到 Teradata Database 上的暂存表中,然后执行从暂存表到目标表的 where clause。
用法说明
- 未提供外部服务器时,将自动选择 TDCH。
- Data Mover 只支持 Hadoop 上的 Hive。
- Hive 用户必须对 Hadoop 对象具有读写权限 - 权限不正确将导致作业失败。
- 使用 QueryGrid 时,Data Mover 作业定义和外部服务器指定的 Hive 用户必须对基础 Hadoop 对象具有相同的读写权限。
部分复制 XML 文件示例
以下是使用 TDCH 的 Teradata 到 Hadoop 部分表复制的 job_definition 示例。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <dmCreate xmlns="http://schemas.teradata.com/dataMover/v2009" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.teradata.com/dataMover/v2009/DataMover.xsd"> <!-- source td credentials --> <source_tdpid>td_database</source_tdpid> <source_user>username</source_user> <source_password>password</source_password> <!-- target hadoop credentials --> <target_hadoop_system> <webHCat_url>http://webhcat_host:50111</webHCat_url> <oozie_url>http://oozie_host:11000</oozie_url> <file_system_url>http://webhdfs_or_httpfs_host:50070</file_system_url> <hive_user>hive</hive_user> </target_hadoop_system> <!-- true to truncate table on hive, false to append the data to the table on hive--> <overwrite_existing_objects>false</overwrite_existing_objects> <!-- target database on hive --> <target_database> <name>target_database</name> </target_database> <!-- object selection. in this case, we are moving source table on (td) to default target_database on hive --> <database selection="unselected"> <name>source_database</name> <table selection="included"> <name>source_table</name> <target_name>target_table_optional</target_name> <!-- where clause to select partial table on source --> <sql_where_clause> <![CDATA[WHERE columnValue <= num ]]></sql_where_clause> </table> </database> </dmCreate>
以下是使用 QueryGrid 的 Hadoop 到 Teradata 部分表复制的 job_definition 示例。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <dmCreate xmlns="http://schemas.teradata.com/dataMover/v2009" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.teradata.com/dataMover/v2009/DataMover.xsd"> <!-- source hadoop credentials --> <source_hadoop_system> <webHCat_url>http://webhcat_host:50111</webHCat_url> <oozie_url>http://oozie_host:11000</oozie_url> <file_system_url>http://webhdfs_or_httpfs_host:50070</file_system_url> <hive_user>hive</hive_user> </source_hadoop_system> <!-- target td credentials --> <target_tdpid>td_database</target_tdpid> <target_user>username</target_user> <target_password>password</target_password> <!-- target database on hive --> <target_database> <name>target_database</name> </target_database> <use_foreign_server> <name>querygrid_foreign_server_name</name> </use_foreign_server> <!-- object selection. in this case, we are moving source table on (td) to default target_database on hive --> <database selection="unselected"> <name>source_hive_database</name> <table selection="included"> <name>source_table</name> <target_name>target_table_optional</target_name> <!-- where clause to select partial table on source --> <sql_where_clause> <![CDATA[WHERE columnValue <= num ]]></sql_where_clause> </table> </database> </dmCreate>