Thursday 31 July 2014

Oozie Sqoop into Hive Table Permission Issue

Issue: 'usera' run oozie job with sqoop action to create a table under a tmpdb created by 'usera'

FAILED: Error in metadata: MetaException(message:Got exception: org.apache.hadoop.security.AccessControlException Permission denied: user=hive, access=WRITE, inode="/user/hive/warehouse/tmp.db":usera:hive:drwxr-xr-x

This error misleads us on permission.
But the solution is:

Add <job-xml>lib/hive-site.xml</job-xml> in sqoop-action

hive-site.xml has to be included in every action accessing hive table, but not only hive-action.

<action name="PDUImport_Sqoop">
        <sqoop xmlns="uri:oozie:sqoop-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <prepare>
                <delete path='${rawDataPath}'/>
            </prepare>

           <job-xml>lib/hive-site.xml</job-xml>
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
            </configuration>
            <arg>--options-file</arg>
            <arg>${optionFile}</arg>
            <file>${optionFile}</file>
        </sqoop>
        <ok to="fork-node"/>
        <error to="Kill"/>
    </action>



Reference
http://archive.cloudera.com/cdh4/cdh/4/oozie/DG_CommandLineTool.html#Impersonation_doAs
http://demo.gethue.com/help/beeswax
http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH4-Security-Guide/cdh4sg_topic_9_1.html?scroll=topic_9_1_3_unique_1__title_140_unique_1


No comments:

Post a Comment