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;

  • Property & gt; & lt; name & gt; nameNode & lt; / name & gt; & lt; value & gt; $ storageUri & lt; / value & gt; & lt; / property & gt; & lt; Property & gt; & lt; name & gt; Jo obTracker & lt; / name & gt; & lt; value & gt; jobtrackerhost: 9010 & lt; / pricing & gt; & gt; / property & gt; & lt; Property & gt; & lt; name & gt; queueName & lt; / name & gt; & lt; value & gt; default & lt; / pricing & gt; & gt; & gt; & gt; asset & gt; asset & gt; ; & Lt; name & gt; oozie.use.system.l ibpath & lt; / name & gt; & gt; value & gt; true & lt; / pricing & gt; & lt; / asset & gt; & lt; asset & gt; & lt; name & gt; hiveScript & lt ; / Name & gt; Price & gt; $ hiveScript & lt; / pricing & gt; & lt; / asset & gt; & lt; asset & gt; & lt; name & gt; hiveTableName & lt; / Name & gt; & lt; value & gt; $ hiveTableName & lt; / pricing & gt; & Lt; / Property & gt; & Lt; Property & gt; & Lt; Name & gt; HiveDataFolder & lt; / Name & gt; & Lt; Price & gt; $ HiveDataFolder & lt; / Pricing & gt; & Lt; / Property & gt; & Lt; Property & gt; & Lt; Name & gt; HiveOutputFolder & lt; / Name & gt; & Lt; Price & gt; $ HiveOutputFolder & lt; / Pricing & gt; & Lt; / Property & gt; & Lt; Property & gt; & Lt; Name & gt; User.name & lt; / Name & gt; & Lt; Price & gt; Admin & lt; / Pricing & gt; & Lt; / Property & gt; & Lt; Property & gt; & Lt; Name & gt; Oozie.wf.application.path & lt; / Name & gt; & Lt; Price & gt; $ OozieWFPath & lt; / Pricing & gt; & Lt; / Property & 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

    Popular posts from this blog

    Java - Error: no suitable method found for add(int, java.lang.String) -

    java - JPA TypedQuery: Parameter value element did not match expected type -

    c++ - static template member variable has internal linkage but is not defined -