sqoop基本命令

可以使用sqoop help命令来查看sqoop支持哪些命令

  

1.列举mysql有多少个数据库

sqoop list-databases 
--connect jdbc:mysql://localhost:3306 
--username root 
--password root

  

  

2.列举某个mysql数据库存在的表

sqoop list-tables 
--connect jdbc:mysql://localhost:3306/hive 
--username root 
--password root

  

  

3.创建一张与mysql数据库中的user表相同结构的hive表(hive_user)

  3.1 要求

    (1)开启hive服务

    (2)将hive安装目录lib下的hive-common-2.3.6.jar复制到sqoop的lib目录下   

cp /opt/module/hive/lib/hive-common-2.3.6.jar /opt/module/sqoop/lib/

      

sqoop create-hive-table --connect jdbc:mysql://localhost:3306/test --username root --password root --table user --hive-table hive_user
原文地址:https://www.cnblogs.com/wnwn/p/12957127.html