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