Support Questions

Find answers, ask questions, and share your expertise

phoenix query execution using oozie java action on secure cluster

avatar

Hello,

I am trying to execute phoenix queries from oozie using java action and I am facing kinit issues. Please note if I run this java code standalone ( without using oozie ), it works fine, however, issue is faced while running from oozie java action.

Below is my sample java code to use phoenix jdbc.

UserGroupInformation.setConfiguration(configuration);
UserGroupInformation.loginUserFromKeytab("exm_qa@ABC.VIBGYOR.COM","/etc/security/keytabs/exm_qa.headless.keytab");

Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
conn =  DriverManager.getConnection("jdbc:phoenix:santhosh-blueprint-test-13.XXX:2181:/hbase-secure");
System.out.println("got connection");
Statement statement = conn.createStatement();

Below is how the oozie workflow action XML is defined.



<action name="java_query">

    <java>

      <main-class>PhoenixQueryExecutor</main-class>
      <archive>/user/exm_qa/oozie/apps/shell/lib/original-phoenix-query-executor-1.0-SNAPSHOT.jar</archive>

    </java>

    <ok to="end"/>

    <error to="fail"/>

</action>

Below is the oozie job properties. I have placed the hbase-site.xml and phoenix-client.jar under oozie.libpath dir.

oozie.use.system.libpath = true
oozie.libpath=hdfs://chelsea/user/exm_qa/oozie/apps/shell/lib

however it does logs below line, which means login was successful.

2016-11-05 18:01:25,380 INFO [main] org.apache.hadoop.security.UserGroupInformation: Login successful for user exm_qa@ABC.VIBGYOR.COM using keytab file /etc/security/keytabs/exm_qa.headless.keytab
2016-11-05 18:01:25,435 INFO [main] org.apache.hadoop.security.UserGroupInformation: Login successful for user exm_qa@ABC.VIBGYOR.COM using keytab file /etc/security/keytabs/exm_qa.headless.keytab

Snippet of error . Complete error is here oozie-phoenix-java-action.txt

2016-11-05 18:01:35,848 FATAL [hconnection-0x236134a1-shared--pool1-t1] org.apache.hadoop.hbase.ipc.AbstractRpcClient: SASL authentication failed. The most likely cause is missing or invalid credentials. Consider 'kinit'.
javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]
	at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5Client.java:211)
	at org.apache.hadoop.hbase.security.HBaseSaslRpcClient.saslConnect(HBaseSaslRpcClient.java:179)
	at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.setupSaslConnection(RpcClientImpl.java:611)
	at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.access$600(RpcClientImpl.java:156)
	at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection$2.run(RpcClientImpl.java:737)
	at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection$2.run(RpcClientImpl.java:734)
	at java.security.AccessController.doPrivileged(Native Method)
1 ACCEPTED SOLUTION

avatar

Followed the steps mentioned in this article and it started working !!

View solution in original post

1 REPLY 1

avatar

Followed the steps mentioned in this article and it started working !!