Sqoop data export and import commands

Source: Internet
Author: User
Tags hadoop ecosystem sqoop

Sqoop data export and import commands

1. import data from mysql to hive

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

Here, -- table tb1 is a table in the mysql sqoop database, and -- hive-table tb1 is the name of the table imported to hive. You do not need to create a table first.

2. import data from hive to 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 imported to mysql. You must create a table first.

3. import data from mysql to hdfs

Sqoop import -- connect jdbc: mysql: // localhost: 3306/sqoop -- direct -- username root -- password 123456 -- table tb1-m 1

4. import data from hdfs to 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

Create a tb1 table in mysql.

When sqoop is used to import mysql Data to hdfs, the following error is reported:

Java. SQL. SQLException: Streaming result set com. mysql. jdbc. rowDataDynamic @ 54b0a583 is still active. no statements may be issued when any streaming result sets are open and in use on a given connection. ensure that you have called. close () on any active streaming result sets before attempting more queries.

After query, caused by mysql JDBC driver bug, I use the mysql-connector-java-5.1.10-bin.jar version, after changed to the mysql-connector-java-5.1.25-bin.jar version of the NO PROBLEM

Implement data import between Mysql, Oracle, and HDFS/Hbase through Sqoop

[Hadoop] Detailed description of Sqoop Installation Process

Use Sqoop to export data between MySQL and HDFS Systems

Hadoop Oozie learning notes Oozie does not support Sqoop Problem Solving

Hadoop ecosystem construction (hadoop hive hbase zookeeper oozie Sqoop)

Full history of Hadoop learning-use Sqoop to import MySQL Data to Hive

Sqoop details: click here
Sqoop: click here

This article permanently updates the link address:

Related Article

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.