Sqoop export failed while export data from HDFS directory to MySQL table

sqoop

#1

HI ALL,
I have created a table in MySQL and now I want to export some data from HDFS directory, but Sqoop export command fails to export data using --update-key and --update mode arguments;

Table in mysql :
create table export_table ( id int not null, name varchar(50) null, phno int null, PRIMARY KEY (id));

Data in export_table;
----------------------------------------------------
| id | name | phno |
----------------------------------------------------
| 1 | aaa | 123 |
| 2 | bbb | 456 |
| 3 | ccc | 325 |
----------------------------------------------------

file in hdfs name export.csv:
3,xyz
4,newdata

sqoop export command :

sqoop export \
--connect "jdbc:mysql://sandbox.hortonworks.com:3306/<mysql_database>" \
--username root \
--password hadoop \
--table export_table \
--export-dir /user/root/input/export.csv \
-m 1 \
--update-key id \
--update-mode allowinsert

But I am facing some following error ;

18/07/25 10:43:46 INFO mapreduce.Job:  map 0% reduce 0%
18/07/25 10:44:01 INFO mapreduce.Job:  map 100% reduce 0%
18/07/25 10:44:02 INFO mapreduce.Job: Job job_1532510240648_0003 failed with state FAILED due to: Task failed task_1532510240648_0003_m_000000
Job failed as tasks failed. failedMaps:1 failedReduces:0

18/07/25 10:44:02 INFO mapreduce.Job: Counters: 8
        Job Counters
                Failed map tasks=1
                Launched map tasks=1
                Data-local map tasks=1
                Total time spent by all maps in occupied slots (ms)=12328
                Total time spent by all reduces in occupied slots (ms)=0
                Total time spent by all map tasks (ms)=12328
                Total vcore-milliseconds taken by all map tasks=12328
                Total megabyte-milliseconds taken by all map tasks=3082000
18/07/25 10:44:02 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
18/07/25 10:44:02 INFO mapreduce.ExportJobBase: Transferred 0 bytes in 51.1843 seconds (0 bytes/sec)
18/07/25 10:44:02 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
18/07/25 10:44:02 INFO mapreduce.ExportJobBase: Exported 0 records.
18/07/25 10:44:02 ERROR mapreduce.ExportJobBase: Export job failed!
18/07/25 10:44:02 ERROR tool.ExportTool: Error during export: Export job failed!

Kindly help me to solve this.

Reards,
Jay.