【问题标题】:Import in HIVE from MySql using Sqoop使用 Sqoop 从 MySql 导入 HIVE
【发布时间】:2018-09-17 20:57:49
【问题描述】:
sqoop import --connect jdbc:mysql://mysql.example.com/i --username root --password root --table Student --hive-home /user/hive/warehouse --hive-import --create-hive-table --hive-table databasename.tablename -m 1

在 Hive 表名“tab1”和数据库“abc”中未显示任何数据。 MySQL数据库名inst和表名stu

【问题讨论】:

  • 你试过--connect jdbc:mysql://mysql.example.com/inst
  • sqoop import --connect jdbc:mysql://mysql.example.com/inst --username root --password root --table stu --hive-home /user/hive/warehouse - -hive-import --create-hive-table --hive-table abc.tab12 -m 1 ...fir bhi run nhi hua

标签: mysql hive sqoop


【解决方案1】:

在命令中你应该使用--warehouse-dir 或--target-dir 而不是--hive-home。如果未提供上述两个参数中的任何一个,则数据的位置将采用默认位置。但是 --hive-home 用于覆盖 $HIVE_HOME 值。因此,它将在您提到的路径中查找配置单元,但其中没有配置单元,并且您提到的该位置没有默认位置的目录。所以不会存储任何数据,只有创建了表。因此,请尝试不使用 --Hive-home。你的命令将是

sqoop import --connect jdbc:mysql://mysql.example.com/i --username root --password root --table Student --target-dir /path/in/hdfs --hive-import - -create-hive-table --hive-table databasename.tablename

【讨论】: