teradata的sqoop增量导入失败

ig9co6j1  于 2021-06-03  发布在  Sqoop
关注(0)|答案(1)|浏览(444)

我的平台:CDH5.10QuickStart虚拟机和teradata tdexpress 16虚拟机版本。我正在使用sqoop和teradata jdbc驱动程序tdgssconfig.jar、teradata-connector-1.5.3.jar、terajdbc4.jar我的sqoop作业失败,出现以下错误。
有什么建议吗?

[cloudera@quickstart sqoop]$ sqoop job --create incjobtd1 -- import --connect jdbc:teradata://192.168.142.129/DATABASE=teradb  --driver com.teradata.jdbc.TeraDriver  --username dbc --password dbc   --table ACCT   --incremental lastmodified
       --check-column  ECF_XTRC_TS        --target-dir /user/cloudera/teradb/acct2 -m 1 --as-parquetfile  --append
    Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
    Please set $ACCUMULO_HOME to the root of your Accumulo installation.
    17/08/09 01:44:49 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.10.0
    17/08/09 01:44:54 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
    [cloudera@quickstart sqoop]$ sqoop job --exec incjobtd1
    Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
    Please set $ACCUMULO_HOME to the root of your Accumulo installation.
    17/08/09 01:45:14 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.10.0
    Enter password:
    17/08/09 01:45:25 WARN sqoop.ConnFactory: Parameter --driver is set to an explicit driver however appropriate connection manager is not being set (via --connection-manager). Sqoop is going to fall back to org.apache.sqoop.manager.GenericJdbcManager. Please specify explicitly which connection manager should be used next time.
    17/08/09 01:45:25 INFO manager.SqlManager: Using default fetchSize of 1000
    17/08/09 01:45:25 INFO tool.CodeGenTool: Beginning code generation
    17/08/09 01:45:25 INFO tool.CodeGenTool: Will generate java class as codegen_ACCT
    17/08/09 01:45:32 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM ACCT AS t WHERE 1=0
    17/08/09 01:45:32 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM ACCT AS t WHERE 1=0
    17/08/09 01:45:32 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/lib/hadoop-mapreduce
    Note: /tmp/sqoop-cloudera/compile/fc68a3f34abd80bde713cf1709dbc330/codegen_ACCT.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    17/08/09 01:45:54 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-cloudera/compile/fc68a3f34abd80bde713cf1709dbc330/codegen_ACCT.jar
    17/08/09 01:46:06 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM ACCT AS t WHERE 1=0
    17/08/09 01:46:07 ERROR manager.SqlManager: SQL exception accessing current timestamp: java.sql.SQLException: [Teradata Database] [TeraJDBC 16.00.00.23] [Error 3706] [SQLState 42000] Syntax error: expected something between '(' and ')'.
    java.sql.SQLException: [Teradata Database] [TeraJDBC 16.00.00.23] [Error 3706] [SQLState 42000] Syntax error: expected something between '(' and ')'.
            at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDatabaseSQLException(ErrorFactory.java:309)
            at com.teradata.jdbc.jdbc_4.statemachine.ReceiveInitSubState.action(ReceiveInitSubState.java:103)
            at com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.subStateMachine(StatementReceiveState.java:311)
            at com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.action(StatementReceiveState.java:200)
            at com.teradata.jdbc.jdbc_4.statemachine.StatementController.runBody(StatementController.java:137)
            at com.teradata.jdbc.jdbc_4.statemachine.StatementController.run(StatementController.java:128)
            at com.teradata.jdbc.jdbc_4.TDStatement.executeStatement(TDStatement.java:389)
            at com.teradata.jdbc.jdbc_4.TDStatement.executeStatement(TDStatement.java:331)
            at com.teradata.jdbc.jdbc_4.TDStatement.doNonPrepExecuteQuery(TDStatement.java:319)
            at com.teradata.jdbc.jdbc_4.TDStatement.executeQuery(TDStatement.java:1121)
            at org.apache.sqoop.manager.SqlManager.getCurrentDbTimestamp(SqlManager.java:987)
            at org.apache.sqoop.tool.ImportTool.initIncrementalConstraints(ImportTool.java:328)
            at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:498)
            at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:615)
            at org.apache.sqoop.tool.JobTool.execJob(JobTool.java:213)
            at org.apache.sqoop.tool.JobTool.run(JobTool.java:268)
            at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
            at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
            at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
            at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
            at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
            at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
    17/08/09 01:46:07 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: Could not get current time from database
            at org.apache.sqoop.tool.ImportTool.initIncrementalConstraints(ImportTool.java:330)
            at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:498)
            at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:615)
            at org.apache.sqoop.tool.JobTool.execJob(JobTool.java:213)
            at org.apache.sqoop.tool.JobTool.run(JobTool.java:268)
            at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
            at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
            at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
            at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
            at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
            at org.apache.sqoop.Sqoop.main(Sqoop.java:236)

    [cloudera@quickstart sqoop]$
yhqotfr8

yhqotfr81#

你用过 --append 以及 lastmodified 一起修改。这是不对的。请在下面找到它们之间的详细区别。
sqoop支持两种类型的增量导入:append和 lastmodified . 可以使用--incremental参数指定要执行的增量导入的类型。
您应该指定 append 当导入一个表时,在该表中不断添加新行并增加行id值。指定包含行id的列 --check-column . sqoop导入check列的值大于用指定值的行 --last-value .
sqoop支持的另一种表更新策略称为 lastmodified 模式。当源表的行可能被更新时,您应该使用这个选项,并且每次这样的更新都会将上次修改的列的值设置为当前时间戳。
因此,假设您的表也有一些新的insert和sone-net更新,您的sqoop作业将是。 sqoop job --create incjobtd1 -- import --connect jdbc:teradata://192.168.142.129/DATABASE=teradb \ --driver com.teradata.jdbc.TeraDriver --username dbc --password dbc \ --table ACCT --incremental lastmodified --check-column ECF_XTRC_TS \ --target-dir /user/cloudera/teradb/acct2 -m 1 --as-parquetfile

相关问题