Durga Gadiraju

173.Sqoop Import – Managing HDFS Directories – append or overwrite or fail

Command to import order_items table and overwrite the directory if exists: sqoop import –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity –table order_items –warehouse-dir /user/training/sqoop_import/retail_db –delete-target-dir To append to the existing directory use –append in place of –delete-target-dir.

171.Perform Sqoop Import of orders – –table and – –target-dir

Command to check if the directory path exists: hadoop fs -ls /user/training/sqoop_import Command to create the directory if it doesn’t exist: hadoop fs -mkdir /user/training/sqoop_import Command to import orders table: sqoop import –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity –table orders –target-dir /user/training/sqoop_import/retail_db/orders To validate the imported table: hadoop fs -Is /user/training/sqoop_import/retail_db/orders

169.Redirecting Sqoop Logs into files

To redirect log messages to other files sqoop eval –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity –query “SELECT * FROM orders LIMIT 10” l>query.out 2>query.err In above command, 1 refers to standard output, Where output will be redirected and saved to file query.out. 2 refers to standard error, Where error message will be redirected and saved …

169.Redirecting Sqoop Logs into files Read More »