194.Sqoop Import – “import-all-tables”

  • To refer to information related to import-all-tables command
    • Sqoop help import-all-tables
  • Command to delete directory in hdfs
    • hadoop fs -rm -R /user/training/sqoop_import/retail_db
  • Command to get list of tables
    • sqoop list-tables --connect jdbc:mysql://ms.itversity.com:3306/retail_db --username retail_user --password itversity
  • Command to import all tables at once
    • sqoop import-all-tables --connect jdbc:mysql://ms.itversity.com:3306/retail_db --username retail_user --password itversity --warehouse-dir /user/training/sqoop_import/retail_db --autoreset-to-one-mapper --num-mappers 2
  • Command to validate files
    • hadoop fs -Is /user/training/sqoop_import/retail_db
    • hadoop fs -Is /user/training/sqoop_import/retail_db/order_items_nopk
    • hadoop fs -Is /user/training/sqoop_import/retail_db/order_items
    • hadoop fs -tail /user/training/sqoop_import/retail_db/order_items/part-m-00001

Share this post