[sqoop] sqoop 小试牛刀

 

 

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

相关文章
相关标签/搜索