Sqoop Data Export Import command

Source: Internet
Author: User
Tags sqoop

1. Import data from MySQL into hive

Sqoop Import--connect Jdbc:mysql://localhost:3306/sqoop--direct--username root--password 123456-- Table Tb1--hive-table tb1--hive-import-m 1

Where--table tb1 is a table in the MySQL sqoop database,--hive-table tb1 is the name of the table that was imported into hive without having to build the table beforehand.

2. Import data from hive into MySQL

Sqoop export--connect jdbc:mysql://localhost:3306/sqoop--username root--password 123456--direct-- table T4--export-dir/user/hive/warehouse/tb1/part-m-00000--input-fields-terminated-by ' \001 '

--table T4 is the name of the table that is imported into MySQL and needs to be built in advance.

3. Import data from MySQL into HDFs

Sqoop Import--connect Jdbc:mysql://localhost:3306/sqoop--direct--username root--password 123456-- Table Tb1-m 1

4. Import data from HDFs into MySQL

Sqoop export--connect jdbc:mysql://localhost:3306/sqoop--direct--table tb1--username root--password 123456--export-dir HDFs://localhost:9000/user/hadoop/tb1/part-m-00000-m 1

It is also necessary to build the TB1 table in MySQL first

The following error was reported in using Sqoop to import data from MySQL into HDFs:

inch  more queries.

Query, caused by MySQL JDBC driver bug, I use the Mysql-connector-java-5.1.10-bin.jar version, and then change to the Mysql-connector-java-5.1.25-bin.jar version, there is no problem.

Sqoop Data Export Import command

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.