sqoop 1.4.6 小試牛刀html
sqoop import 參數mysql
1. mysql導入 到hdfs中sql
./sqoop import --connect jdbc:mysql://mysql:3306/part --username root --password 123456 --table big_hdfs -m 1 --target-dir /sqoop/import/mysql/apache
2. mysql 導入 到 hive 指定庫 中ide
./sqoop import --hive-import --connect jdbc:mysql://mysql:3306/part --username root --password 123456 --table big_hdfs -m 1 --hive-database udataoop
3. mysql 結果集 導入 到指定hive表中ui
where 條件中加上 $CONDITIONS 就能夠了htm
./sqoop import --hive-import --connect jdbc:mysql://mysql:3306/part --username root --password 123456 -m 1 --query 'select id,name,htime from big_hdfs where id<=6 and $CONDITIONS' --target-dir '/sqoop1/import/mysql' --hive-table mysql_import_hdfsblog
4. hdfs 導出到mysql中get
./sqoop export --connect jdbc:mysql://mysql:3306/part --username root --password 123456 --table big_person -m 1 --export-dir '/hive/warehouse/test1.db/com_inner_person/person.data'
mysql中的表要提早建好,不然拋出異常。
以下信息,導入成功
hdfs中的數據
導入的數據
參考:
http://sqoop.apache.org/docs/1.4.6/SqoopUserGuide.html#_introduction