Hadoop's--sqoop Notes

Source: Internet
Author: User
Tags sqoop

Reprint Please specify source: http://blog.csdn.net/l1028386804/article/details/46517039

Sqoop is used to import and export data.

(1) Import data from databases such as MySQL, Oracle, etc. into HDFs, Hive, HBase
(2) Export data from HDFs, Hive and hbase to databases such as MySQL, Oracle, etc.
1. Import data from MySQL to HDFs (default is/user/<username>)

Sqoop import--connect jdbc:mysql://hadoop0:3306/hive  --username root--password admin--table tbls-- Fields-terminated-by ' \ t '  --null-string ' * * '-  M 1--append  --hive-import
Sqoop import--connect jdbc:mysql://hadoop0:3306/hive  --username root--password admin--table tbls-- Fields-terminated-by ' \ t '  --null-string ' * * '  -M 1--append  --hive-import  --check-column ' tbl_id '-- Incremental Append--last-value 6

2. Export data from HDFs to MySQL

  Sqoop export--connect jdbc:mysql://hadoop0:3306/hive  --username root--password admin--table IDs-- Fields-terminated-by ' \ t '--export-dir '/ids '

3. Set as job, run job

  Sqoop Job--create myjob--Import--connect jdbc:mysql://hadoop0:3306/hive  --username root--password admin--table T BLS--fields-terminated-by ' \ t '  --null-string ' * * '-  M 1--append  

4. Import the exported transactions in the Mapper task unit.

Hadoop's--sqoop Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.