Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Control arguments
- ---------------------append------------------------------------------------------------------------------
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba \
- --password itversity --warehouse-dir "/user/krishnatejathatavarthi/retail_db" --table order_items --append;
- ---------------------file format----------------------------------------------------------------
- a) sequence file
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba \
- --password itversity --target-dir "/user/krishnatejathatavarthi/retail_db/order_items_seq" --table order_items --as-sequencefile
- b) avrodatafile
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba \
- --password itversity --target-dir "/user/krishnatejathatavarthi/retail_db/order_items_avro" \
- --table order_items --as-avrodatafile
- --------------------------------------NO PK-----------------------------------------------------
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_import" --username retail_dba \
- --password itversity --target-dir "/user/krishnatejathatavarthi/retail_db/order_items_no_pk" \
- --table tb_order_items_no_pk -- till through error
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_import" --username retail_dba \
- --password itversity --target-dir "/user/krishnatejathatavarthi/retail_db/order_items_no_pk_mappers" \
- --table tb_order_items_no_pk --num-mappers 1
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_import" --username retail_dba \
- --password itversity --target-dir "/user/krishnatejathatavarthi/retail_db/order_items_no_pk_mappers" \
- --table tb_order_items_no_pk --split-by order_item_id \
- --boundary-query "select min(order_item_id), max(order_item_id) from tb_order_item_no_pk where order_item_id not in (1000000)"
- ---------------------------------work shop 7------------------------------------------------------------------------
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba \
- --password itversity \
- --table order_items \
- --columns "order_item_id,order_item_order_id,order_item_product_id" \
- --hive-import \
- --create-hive-table \
- --hive-overwrite \
- --hive-database db_krishna \
- --hive-table order_items_sqoop \
- --map-column-hive order_item_id=bigint
- --target-dir "/user/krishnatejathatavarthi/retail_db/order_items_no_pk_mappers" \
- ----------------------------------------------------workshop 8------------------------------------------------------
- create table orders_sqoop(
- order_id int,
- order_date timestamp,
- order_customer_id int,
- order_status varchar(45));
- );
- -------with hive import
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba \
- --password itversity \
- --table orders \
- --hive-import \
- --hive-database db_krishna \
- --hive-table orders_sqoop
- ---without hive import
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba \
- --password itversity \
- --table orders \
- --target-dir hdfs://nn01.itversity.com:8020/apps/hive/warehouse/db_krishna.db/orders_sqoop \
- --append
- --------------------------
- create table orders_sqoop(
- order_id int,
- order_date timestamp,
- order_customer_id int,
- order_status varchar(45))
- row format delimited fields terminated by "|";
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba \
- --password itversity \
- --table orders \
- --target-dir hdfs://nn01.itversity.com:8020/apps/hive/warehouse/db_krishna.db/orders_sqoop \
- --append \
- --fields-terminated-by '|'
- -------------------------
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba --password itversity \
- --table orders --target-dir hdfs://nn01.itversity.com:8020/user/krishnatejathatavarthi/db_krishna.db/orders \
- --append --fields-terminated-by '|' --check-column order_id --incremental append --last-value 60000
- ---------------------workshp 9------import all tables----------------------------------------------------------
- sqoop import-all-tables --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" \
- --username retail_dba --password itversity \
- --warehouse-dir /user/krishnatejathatavarthi/import_all_tables \
- --exclude-tables "departments,categories" \
- -as-avrodatafile
- ---------hive import --------------
- sqoop import-all-tables --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" \
- --username retail_dba --password itversity \
- --exclude-tables "orders" \
- --hive-import --hive-database db_krishna
- -----------------------------Exercise import-----------------------------------------
- sqoop list-databases --connect "jdbc:mysql://nn01.itversity.com:3306" --username retail_dba --password itversity
- sqoop list-tables --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba --password itversity
- sqoop eval --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba --password itversity \
- --query "select * from order_items limit 10"
- --table order_items --where order_items_id < 10
- hadoop fs -mkdir /user/krishnatejathatavarthi/sqoop_exer_12
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba --password itversity \
- --table orders --columns "order_customer_id,order_status" --warehouse-dir "/user/krishnatejathatavarthi/sqoop_exer_12" \
- --as-avrodatafile
- sqoop import-all-tables --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba --password itversity \
- --warehouse-dir "/user/krishnatejathatavarthi/sqoop_exer_12" \
- --as-avrodatafile --exclude-tables orders
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba --password itversity \
- --table orders --warehouse-dir "/user/krishnatejathatavarthi/sqoop_exer_12" \
- --as-avrodatafile
- sqoop eval --connect "jdbc:mysql://nn01.itversity.com:3306/nyse" --username nyse_ro --password itversity \
- --query "describe stocks_eod"
- sqoop import --connect "jdbc:mysql://nn01.itversity.com:3306/nyse" --username nyse_ro --password itversity \
- --warehouse-dir "/user/krishnatejathatavarthi/sqoop_exer_12" \
- --table stocks_eod \
- --compression-codec org.apache.hadoop.io.compress.SnappyCodec --m 8
- sqoop import-all-tables --connect "jdbc:mysql://nn01.itversity.com:3306/retail_db" --username retail_dba --password itversity \
- --hive-import \
- --hive-overwrite --create-hive-table \
- --hive-database db_krishna_sqoop \
- --fields-terminated-by '|' \
- --warehouse-dir "/user/krishnatejathatavarthi/sqoop_exer_hive"
Add Comment
Please, Sign In to add comment