Use of Sqoop-20160410

Source: Internet
Author: User
Tags sqoop

1 Import and Export database
1) List all database commands in the MySQL database
# sqoop list-databases--connect jdbc:mysql://localhost:3306/--username root--password 123456

2) Connect MySQL and list the table commands in the database
# sqoop List-tables--connect jdbc:mysql://localhost:3306/test--username root--password 123456
The test in the command is the name of the test database in the MySQL database username password The user password for the MySQL database, respectively

3) Copy the table structure of the relational data into hive
Sqoop create-hive-table--connect jdbc:mysql://localhost:3306/test--table username--username root--password 123456-- Hive-table Test
Where--table username is the table in the database test in MySQL--hive-table test is the new table name in hive

4) Import files from a relational database into hive
Sqoop Import--connect jdbc:mysql://localhost:3306/test--username root--password mysql-password--table T1-- Hive-import

5) Import table data from hive into MySQL

./sqoop export--connect jdbc:mysql://localhost:3306/test--username root--password admin--table uv_info--export-dir/ user/hive/warehouse/uv/dt=2011-08-03

6) uploading data to Hadoop

Sqoop Import--connect jdbc:mysql://10.2.136.24:3306/test--username root--table aa-m 1

Use of Sqoop-20160410

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.