Sqoop命令--hive-import失败

时间:2011-08-11 16:38:49

标签: hive sqoop

我尝试使用Hadoop将数据库从mysql导入Hive,并使用Sqoop中的“--hive-import”命令自动创建表并将数据加载到配置单元。

我使用下面的命令用sqoop

执行导入
./sqoop import --connect jdbc:mysql://localhost/testhive --table temenan -m 1 --hive-import --username anwar -P

当我执行此命令时,会发生错误

8/11 23:02:49 INFO hive.HiveImport: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.security.UserGroupInformation.login(Lorg/apache/hadoop/conf/Configuration;)Lorg/apache/hadoop/security/UserGroupInformation;
11/08/11 23:02:49 INFO hive.HiveImport:     at org.apache.hadoop.hive.shims.Hadoop20Shims.getUGIForConf(Hadoop20Shims.java:448)
11/08/11 23:02:49 INFO hive.HiveImport:     at org.apache.hadoop.hive.ql.security.HadoopDefaultAuthenticator.setConf(HadoopDefaultAuthenticator.java:51)
11/08/11 23:02:49 INFO hive.HiveImport:     at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
11/08/11 23:02:49 INFO hive.HiveImport:     at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
11/08/11 23:02:49 INFO hive.HiveImport:     at org.apache.hadoop.hive.ql.metadata.HiveUtils.getAuthenticator(HiveUtils.java:222)
11/08/11 23:02:49 INFO hive.HiveImport:     at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:241)
11/08/11 23:02:49 INFO hive.HiveImport:     at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:463)
11/08/11 23:02:49 INFO hive.HiveImport:     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11/08/11 23:02:49 INFO hive.HiveImport:     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
11/08/11 23:02:49 INFO hive.HiveImport:     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11/08/11 23:02:49 INFO hive.HiveImport:     at java.lang.reflect.Method.invoke(Method.java:616)
11/08/11 23:02:49 INFO hive.HiveImport:     at org.apache.hadoop.util.RunJar.main(RunJar.java:186)
11/08/11 23:02:49 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: Hive exited with status 1
    at com.cloudera.sqoop.hive.HiveImport.executeExternalHiveScript(HiveImport.java:326)
    at com.cloudera.sqoop.hive.HiveImport.executeScript(HiveImport.java:276)
    at com.cloudera.sqoop.hive.HiveImport.importTable(HiveImport.java:218)
    at com.cloudera.sqoop.tool.ImportTool.importTable(ImportTool.java:362)
    at com.cloudera.sqoop.tool.ImportTool.run(ImportTool.java:423)
    at com.cloudera.sqoop.Sqoop.run(Sqoop.java:144)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
    at com.cloudera.sqoop.Sqoop.runSqoop(Sqoop.java:180)
    at com.cloudera.sqoop.Sqoop.runTool(Sqoop.java:219)
    at com.cloudera.sqoop.Sqoop.runTool(Sqoop.java:228)
    at com.cloudera.sqoop.Sqoop.main(Sqoop.java:237)

我的sqoop命令出了什么问题?或者在sqoop或hive中有其他配置吗?

请帮帮我

3 个答案:

答案 0 :(得分:1)

您必须添加--hive-table参数并在hive中提及该表。以下命令将自动在配置单元中创建一个名为 temenan_hive

的表格
./sqoop import --connect jdbc:mysql://localhost/testhive --table temenan -m 1  --username anwar -P --hive-import --hive-table temenan_hive

答案 1 :(得分:0)

我已将CDH3.1降级为CDH3.0,然后我将Hive Metastore更改为静态,如下所示:

<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:derby:;databaseName=/home/hadoop/metastore_db;create=true</value>
  <description>JDBC connect string for a JDBC metastore</description>
</property>

然后一切顺利:)

全力以赴

答案 2 :(得分:0)

您可以尝试使用 create-hive-table 工具,根据HDFS中的表格,使用表定义填充Hive Metastore。

Follow the link for create-hive-table