hadoop-sqoop学习笔记


======导入====

sqoop import --connect jdbc:mysql://20.12.20.165:3306/luo0907 --username root --password 12345 --table aa01 --fields-terminated-by ' ' -m 1 --hive-import

sqoop import --connect jdbc:mysql://20.12.20.165:3306/luo0907 --username root --password 12345 --table aa01 --fields-terminated-by ' ' -m 1 --hive-import --hive-overwrite --create-hive-table --hive-table luo0908.aa01 --delete-target-dir
sqoop import --connect jdbc:mysql://20.12.20.165:3306/luo0907 --username root --password 12345 --table aa01 --target-dir /luo2/luo01 ###要用hdfs用户执行

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345' WITH GRANT OPTION;
hadoop fs -chown root:hdfs /tmp/test.txt

=====导出=====
sqoop export --connect jdbc:mysql://20.12.20.165:3306/luo0907 --username root --password 12345 --table aa01 --export-dir '/user/hive/warehouse/luo0908.db/aa01' --fields-terminated-by ' '

原文地址:https://www.cnblogs.com/luo-mao/p/5872411.html