Sqoop job creation


#1

I am getting bellow error while creating the sqoop job.

[raghavendrakumars@gw01 ~]$ sqoop job --create ord_sqoop_job \

–import
–connect “jdbc:mysql://nn01.itversity.com:3306/retail_db”
–username retail_dba --password itversity
–table orders
–num-mappers 5
–split-by order_id
–fields-terminated-by ‘,’
–lines-terminated-by ‘\n’
–hive-import
–hive-database practice_123
–hive-table ord_direct_hive
–outdir java-files
2>sqoop_job.err 1>sqoop_out.log

[raghavendrakumars@gw01 ~]$
[raghavendrakumars@gw01 ~]$ sqoop job --exec ord_sqoop_job
Warning: /usr/hdp/2.5.0.0-1245/accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
17/09/19 11:47:09 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.5.0.0-1245
17/09/19 11:47:10 ERROR hsqldb.HsqldbJobStorage: Cannot restore job: ord_sqoop_job
17/09/19 11:47:10 ERROR hsqldb.HsqldbJobStorage: (No such job)
17/09/19 11:47:10 ERROR tool.JobTool: I/O error performing job operation: java.io.IOException: Cannot restore missing job ord_sqoop_job
at org.apache.sqoop.metastore.hsqldb.HsqldbJobStorage.read(HsqldbJobStorage.java:256)
at org.apache.sqoop.tool.JobTool.execJob(JobTool.java:200)
at org.apache.sqoop.tool.JobTool.run(JobTool.java:298)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:225)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
at org.apache.sqoop.Sqoop.main(Sqoop.java:243)


#2

I got it. There should be a space between – and import. Otherwise it wont create the job.


#3

This is also the case when you want to provide/overwrite any argument.
You need to speciy it like:

sqoop job
–exec saved_job
– --table categories

I hope this helps.