Sqoop 命令 --hive-import 失败

发布于 2024-11-29 03:40:51 字数 2907 浏览 2 评论 0原文

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

我使用下面的命令使用 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 中还有其他配置吗?

请帮助我

I try to import database from mysql to Hive with Hadoop with automatically create table and load data to hive with " --hive-import " command from Sqoop.

I use command below to execute import with sqoop

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

when i execute this command error happen like this

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)

what's wrong with my sqoop command ? or are there other configuration in sqoop or in hive ?

Help me please

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

哭了丶谁疼 2024-12-06 03:40:51

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

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

You have to add --hive-table parameter and mention the table in hive. The below command will automatically create a table in hive with name temenan_hive

./sqoop import --connect jdbc:mysql://localhost/testhive --table temenan -m 1  --username anwar -P --hive-import --hive-table temenan_hive
初见 2024-12-06 03:40:51

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

<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>

然后一切正常:)

谢谢大家

I have downgrade CDH3.1 to CDH3.0 , then i change Hive metastore to static as below:

<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>

then all works well :)

Thnks all

清风疏影 2024-12-06 03:40:51

您可以尝试使用 create-hive-table 工具根据 HDFS 中存在的表使用表定义填充 Hive 元存储。

点击 create-hive-table 的链接

You can try create-hive-table tool to populate a Hive metastore with the table definition based on the table present in HDFS.

Follow the link for create-hive-table

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文