powershell - HDInsight Oozie: Hive Job Parameters -
I am working in the process of automating the hive jobs using Oozie scipts. In the workflow.exml, I get the value from the Powershell script file (OZ Job Script).
Where in the HCl file I am unable to get the value defined in the PowerShell script file (Ozzy Job Script).
powerhell script file: <$ HiveScript = "$ storageUri / Oozie / input / useooziewf.hql" # $ hiveScript = "$ warehouse / oz / input /" $ hiveTableName = "log4jlogs" $ hiveDataFolder = " $ StoreUri "$ HiveOutputFolder =" $ storageUri / OozieOutput "$ passwd = to convert- SecureString $ clusterPassword-AsPlainText-Force $ creds = New Object System. Management. Automation. PSCredential ($ cluster user's name, $ passwd) Usage- AzureHDInsightCluster $ cluster name $ OoziePayload = @ "& lt;? Xml version =" 1.0 "encoding =" UTF-8 "& gt; & lt; configuration & gt;
To start the Ozzy job as below:
Create OZ Job Write-Host" sending the following payload in the cluster: "-Forgorounder Green - Host "` n -------- `$ $ OoziePayload_n --------" $ clusterUriCreateJob = "https: //$clusterName.zurehdinsight.net: 443 / oozie / v1 / jobs" $ response = Ahwan- RestMethod -Method post -Uri $ clusterUriCreateJob -Credential $ creds -Body $ OoziePayload -ContentType "application / xml" -OutVariable $ OozieJobName # -debug $ jsonResponse = ConvertFrom-Json (ConvertTo-Json -InputObject $ response) $ OozieJobId = $ jsonResponse [0]. ("ID") Type # - Host "Ozzy Job ID $ ooz IeJobId is ... "# Ozzy Job Writing Host" Ozzy Job is Starting $ oozieJobId ... "- ForegroundColor Green $ clusterUriStartJob ="? Action "on = enabled" https :: //$clusterName.azurehdinsight.net 443 / oozie / v1 / job / "+ $ oozieJobId + $ response = Ahwan- RestMethod -Method keep -Uri $ clusterUriStartJob - Credential $ Credits | format table -HideTableHeaders # -debug hive jobs (HKL file e):
drop table $ {hiveTableName}; Create external table $ {hiveTableName} ( T1 string, t2 string, t3 string, T-4 string, T5 string, T6 string, T7 string) Line format delimited by the ground, 'textfile' The status '$ {hiveDataFolder}' is stored;
Assume that $ oozieWFPath An existing workflow xml, you can try adding parameters for the hive action: & action; action name = "mehhyation"> hive xmlns = "uri: oozie: Hyp-action: 0.2" & gt; Work-tracker & gt; $ {jobTracker} & lt; / work-tracker & gt; & lt; name node & gt; $ {nameNode} & Lt; / Name node & gt; & Lt; Script & gt; $ {HiveScript} & lt; / Script & gt; & Lt; Param & gt; hiveTableName = $ {hiveTableName} & lt; / param & gt; & Lt; Param & gt; hiveDataFolder = $ {hiveDataFolder} & lt; / param & gt; & Lt; / Hive & gt; ... & lt; / Action> Those last two ultimate nodes must pass the Oozie variable to the hive scripts.
Comments
Post a Comment