Durga Gadiraju

179.Validating avro Files using “avro-tools”

Command to delete directory if exists in local file system: rm -rf order_items To copy data from hdfs to local file system: hadoop fs -get /user/training/sqoop_import/retail_db/order_items . To extract schema from file in json format using avro-tools: avro-tools getschema part-m-00000.avro To print first few records from avro file in json format: avro-tools tojson part-m-00000.avro | …

179.Validating avro Files using “avro-tools” Read More »

176.Sqoop Import – Specifying Number of Mappers

Command to import table and customize the number of mappers: 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 –num-mappers 8 To validate: hadoop fs -ls /user/training/sqoop_import/retail_db/order_items

175.Reviewing logs of Sqoop Import

To redirect log messages to other files 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 1>import.out 2>import.err To view the import.out file: view import.out To view the import.err file: view import.err Command to get status of the job: mapred job -status job_id

174.Sqoop Import – Execution Flow

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 validate: sqoop eval –connect jdbc:mysql://ms.itversity.com:3306/retail_db –username retail_user –password itversity -e “DESCRIBE order_items”