I had to choose the Oozie class that support authentication mechanisms. AuthOozieClient supports Kerberos HTTP SPNEGO and simple authentication. Code below should be enough for starting Oozie job.
AuthOozieClient wc = new AuthOozieClient("http://vm1234:11000/oozie");
conf.setProperty(OozieClient.APP_PATH, "hdfs://vm1234.hostname.net:8020/user/hue/oozie/workspaces/_bdp_-oozie-16");
conf.setProperty("nameNode", "hdfs://vm1234.hotname.net:8020");
conf.setProperty("jobTracker", "vm1234.hotname.net:8021");
conf.setProperty("oozie.use.system.libpath", "true");
conf.setProperty("oozie.libpath", "hdfs://vm1234.hotname.net:8020/user/oozie/share/lib");
System.out.println("Workflow job submitted");
while(wc1.getJobInfo(jobId).getStatus() == WorkflowJob.Status.RUNNING) {
Thread.sleep(10 * 1000);
System.out.println("Workflow job running ...");
}
String jobId = wc.run(conf);
System.out.println("Workflow job finished");
To be sure that your flow has started properly you can use following command:
oozie jobs -oozie http://vm1234:11000/oozie -auth SIMPLE
When you need some more details about submitted job:
oozie job -oozie http://vm1234:11000/oozie -info 0000386-131010095736347-oozie-oozi-W
-info is a parameter defined by the Oozie job ID.
No comments:
Post a Comment