从hdfs dir到sybase iq的sqoop导出失败

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

我正在尝试将hdfs文件从hdfs目录导出到sybase iq表。
我已经将sybase驱动程序正确地放置在sqoop lib路径中。
sqoop命令:

sqoop export  \
 --connect jdbc:sybase:Tds:sybasehost:port/DATABASE=OMEGA \
 --username dummy \
 --password dummy \
 --driver com.sybase.jdbc4.jdbc.SybDriver \
 --table omega_sybase_table \
 --export-dir /user/cloudera/omega/output_files/ \
 --input-fields-terminated-by ','

我收到以下错误,导出失败。

17/04/25 16:17:07 INFO mapreduce.Job: Task Id : attempt_1489579695153_4935_m_000002_1, Status : FAILED
Error: java.io.IOException: Can't export data, please check failed map task logs
    at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:112)
    at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:39)
    at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
    at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
    at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1671)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.io.IOException: java.sql.SQLException: SQL Anywhere Error -210: User 'another user' has the row in 'omega_sybase_table' locked
    at org.apache.sqoop.mapreduce.AsyncSqlRecordWriter.write(AsyncSqlRecordWriter.java:233)
    at org.apache.sqoop.mapreduce.AsyncSqlRecordWriter.write(AsyncSqlRecordWriter.java:46)
    at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.write(MapTask.java:658)
    at org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write(TaskInputOutputContextImpl.java:89)
    at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.write(WrappedMapper.java:112)
    at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:84)
    ... 10 more
Caused by: java.sql.SQLException: SQL Anywhere Error -210: User 'another user' has the row in 'omega_sybase_table' locked
    at com.sybase.jdbc4.jdbc.SybConnection.getAllExceptions(Unknown Source)

有人能帮我解决这个问题吗?

inn6fuwd

inn6fuwd1#

由于sqoop export命令中使用了多个mappers任务,因此无法获取。
sybase iq一次只允许一个连接,多个mappers任务试图并行地在sybase iq表中插入记录。
解决方案是在sqoop导出命令中使用-m1。

相关问题