Wednesday, 2 July 2014

Hive Action in Oozie

You need one very important file to execute Hive action through Oozie which is hive-site.xml. When Oozie executes a Hive action, it needs Hive's configuration file. You can provide multiple configurations file in a single action. You can find your Hive configuration file from "/etc/hive/conf.dist/hive-site.xml" (default location).
or "cp /etc/hive/conf.dist/hive-default.xml.template  hive-site.xml
Be careful the metastore property. Otherwise, it will complain can't find the table.
<property>
  <name>hive.metastore.uris</name>
  <value>thrift://upladevhdt01.researchnow.com:9083</value>
  <description>Thrift uri for the remote metastore. Used by metastore client to connect to remote metastore.</description>

</property>

since I'm putting hive-site.xml in my application path, so I'm just passing the file name not the whole location. 
Otherwise, need to specify the path in Hive Action. <file>lib/hive-site.xml</file>

<action name="hive-node">
<hive xmlns="uri:oozie:hive-action:0.2">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<job-xml>hive-site.xml</job-xml>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<script>script.hql</script>
<param>INPUT_PATH=${inputPath}</param>
</hive>
<ok to="end"/>
<error to="fail"/>
</action>

Reference:
http://www.tanzirmusabbir.com/2013/03/oozie-example-hive-actions.html

No comments:

Post a Comment