Sqoop ETL工具的基本操作
查看 sqoop 命令说明
sqoop help
查看某一个命令的使用说明:
sqoop cammond -help
从orange,mysql到hdfs
sqoop import --connect jdbc:oracle:thin:@192.168.1.254:1521:orcl --username bd_user --password bd_user --table GS_B_GY_DWCPNYXHBJG_S —target-dir '/user/haha/' -m 1
sqoop import --connect jdbc:mysql://192.168.1.232:3307/bigdatamanager --username root --password root --table gbi_pd_log —target-dir /user/hehe -m 1
从oracle,mysql到hive
sqoop import-all-tables --connect jdbc:oracle:thin:@192.168.1.232:14231:xe --username bhl_user --password bhl_user --hive-database bhl_user -m 1 --create-hive-table --hive-import —hive-overwrite
sqoop import --connect jdbc:oracle:thin:@192.168.1.232:14231:xe --username bhl_user --password bhl_user —table BD_ECO_TX_2015_0516
sqoop import --connect jdbc:oracle:thin:@192.168.1.232:14231:xe --username bhl_user --password bhl_user --table BD_ECO_TX_2015_0516 —hive-import —hive-database bhl_user -m 1(oracle 连接的截图在这就不写了,下面是mysql的测试)
======================================================================
列出数据库:
sqoop list-databases --connect jdbc:mysql://192.168.1.232:3307/bigdatamanager --username root --password root
列出bigdatamanager数据库中的表
sqoop list-tables --connect jdbc:mysql://192.168.1.232:3307/bigdatamanager --username root --password root
从mysql到hive
sqoop import --connect jdbc:mysql://192.168.1.232:3307/bigdatamanager --username root —password root —table insurance_yearcost -hive-import