简体   繁体   English

使用Sqoop从MySql导入HIVE

[英]Import in HIVE from MySql using Sqoop

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

Not showing any data in Hive table name 'tab1' and database is 'abc'. Hive表名称“ tab1”中未显示任何数据,数据库为“ abc”。 MySQL database name inst and table name stu . MySQL数据库名称inst和表名称stu

In the command you should use --warehouse-dir or --target-dir instead of --hive-home. 在命令中,应使用--warehouse-dir或--target-dir而不是--hive-home。 If not provided any of above two parameters the location of the data will take in default location. 如果未提供以上两个参数中的任何一个,则数据的位置将采用默认位置。 But --hive-home is used to overwrite the $HIVE_HOME value. 但是--hive-home用于覆盖$ HIVE_HOME值。 So it will look for hive in that path which you mentioned, but there is no hive in it and there is no dir for default location from that location you mentioned. 因此它将在您提到的路径中寻找配置单元,但是其中没有配置单元,并且从您提到的位置开始没有默认位置的目录。 So no data will be stored only table was created. 因此,仅创建表时将不会存储任何数据。 So try without --Hive-home. 因此,请尝试不使用--Hive-home。 Your command will be 您的命令将是

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 sqoop import --connect jdbc:mysql://mysql.example.com/i --username root --password root --table Student --target-dir / path / in / hdfs --hive-import --create-蜂巢表-蜂巢表databasename.tablename

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM