Exam4Training

Write a Sqoop Job which will import "retaildb.categories" table to hdfs, in a directory name "categories_targetJob".

Write a Sqoop Job which will import "retaildb.categories" table to hdfs, in a directory name "categories_targetJob".

Answer: Solution:

Step 1: Connecting to existing MySQL Database mysql -user=retail_dba –password=cloudera retail_db

Step 2: Show all the available tables show tables;

Step 3: Below is the command to create Sqoop Job (Please note that – import space is mandatory)

sqoop job -create sqoopjob — import

-connect "jdbc:mysql://quickstart:3306/retail_db"

-username=retail_dba

-password=cloudera

-table categories

-target-dir categories_targetJob

-fields-terminated-by ‘|’

-lines-terminated-by ‘n’

Step 4: List all the Sqoop Jobs sqoop job –list

Step 5: Show details of the Sqoop Job sqoop job –show sqoopjob

Step 6: Execute the sqoopjob sqoopjob –exec sqoopjob

Step 7: Check the output of import job

hdfs dfs -Is categories_target_job

hdfs dfs -cat categories_target_job/part*

Latest CCA175 Dumps Valid Version with 96 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Exit mobile version