【问题标题】:Hive script containing load data inpath not working in oozie包含加载数据路径的 Hive 脚本在 oozie 中不起作用
【发布时间】:2016-05-26 12:54:44
【问题描述】:

我的任务是创建一个 oozie 工作流,以每小时将数据加载到 Hive 表。

我在 virtualbox 中使用 CDH 5.7

当我运行包含 LOAD DATA INPATH '/sqoop_import_increment' INTO TABLE customer 的配置单元脚本时;它运行良好,数据被加载到 hive 表中。

但是当我在 oozie 工作流上运行相同的脚本时,作业在 66% 处被终止,并且错误消息是主类 [org.apache.oozie.action.hadoop.HiveMain],退出代码[10001]

注意:但是用于创建表的 hive 脚本与 oozie 工作流程完美配合。 请帮忙。

蜂巢脚本:

use test;

create external table if not exists customer(customer_id int,name string,address string)row format delimited fields terminated by ',';

load data inpath /sqoop_import_increment into table customer;

workflow.xml:

<workflow-app name="hive_script" xmlns="uri:oozie:workflow:0.5">
    <start to="hive-4327"/>
    <kill name="Kill">
        <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <action name="hive-4327" cred="hcat">
        <hive xmlns="uri:oozie:hive-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
              <job-xml>lib/hive-config.xml</job-xml>
            <script>lib/impala-script.hql</script>
        </hive>
        <ok to="End"/>
        <error to="Kill"/>
    </action>
    <end name="End"/>
</workflow-app>

job.properties:

oozie.use.system.libpath=True
security_enabled=False
dryrun=False
jobTracker=localhost:8032
nameNode=hdfs://quickstart.cloudera:8020

hive-config.xml:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>

  <!-- Hive Configuration can either be stored in this file or in the hadoop configuration files  -->
  <!-- that are implied by Hadoop setup variables.                                                -->
  <!-- Aside from Hadoop setup variables - this file is provided as a convenience so that Hive    -->
  <!-- users do not have to edit hadoop configuration files (that may be managed as a centralized -->
  <!-- resource).                                                                                 -->

  <!-- Hive Execution Parameters -->

  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://127.0.0.1/metastore?createDatabaseIfNotExist=true</value>
    <description>JDBC connect string for a JDBC metastore</description>
  </property>

  <property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.jdbc.Driver</value>
    <description>Driver class name for a JDBC metastore</description>
  </property>

  <property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>hive</value>
  </property>

  <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>cloudera</value>
  </property>

  <property>
    <name>hive.hwi.war.file</name>
    <value>/usr/lib/hive/lib/hive-hwi-0.8.1-cdh4.0.0.jar</value>
    <description>This is the WAR file with the jsp content for Hive Web Interface</description>
  </property>

  <property>
    <name>datanucleus.fixedDatastore</name>
    <value>true</value>
  </property>

  <property>
    <name>datanucleus.autoCreateSchema</name>
    <value>false</value>
  </property>

  <property>
    <name>hive.metastore.uris</name>
    <value>thrift://127.0.0.1:9083</value>
    <description>IP address (or fully-qualified domain name) and port of the metastore host</description>
  </property>
</configuration>

【问题讨论】:

  • 您似乎错过了 hive 脚本中路径周围的简单引号!
  • 您检查了启动器作业和配置单元作业日志,其中显示的错误是什么?
  • 我试过用单引号还是不行
  • 我检查了 oozie 中的日志,它显示为 Error:oozie-oozi-W@hive-4327] 启动器错误,原因:主类 [org.apache.oozie.action.hadoop.HiveMain] , 退出代码 [40000] 但我不知道在哪里可以查看配置单元日志,您能帮帮我吗
  • 请在您的 中提供 hive-site.xml 并尝试

标签: hive oozie cloudera-cdh


【解决方案1】:

上次遇到这个问题,原来是所有数据节点都没有安装hive客户端。

当您手动运行 hive 查询时,您可能会从安装了 hive 客户端的节点执行此操作。但是当要求 oozie 运行查询时,它将从随机数据节点执行此操作。因此,您需要在所有数据节点上设置 hive 客户端。

这假设您一般不能让 oozie 运行 hive 查询(并且此特定命令没有任何具体问题)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-15
    • 2014-04-14
    • 2017-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-16
    • 2011-07-29
    相关资源
    最近更新 更多