3
votes

I`m trying to connect a Spark application to HBase with Kerberos enabled. Spark version is 1.5.0, CDH 5.5.2 and it's executed in yarn cluster mode.

When HbaseContext is initialized, it throws this error:

ERROR 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)]

I have tried to do the authentication in the code, adding:

UserGroupInformation.setConfiguration(config)
UserGroupInformation.loginUserFromKeytab(principalName, keytabFilename)

I distribute the keytab file with --files option in spark-submit. Now, the error is:

java.io.IOException: Login failure for [email protected] from keytab krb5.usercomp.keytab: javax.security.auth.login.LoginException: Unable to obtain password from user ...

Caused by: javax.security.auth.login.LoginException: Unable to obtain password from user at com.sun.security.auth.module.Krb5LoginModule.promptForPass(Krb5LoginModule.java:856)

Is this the way to connect to Kerberized HBase from a Spark app?

3
have you missed conf.set("hadoop.security.authentication", "Kerberos"); ?Ram Ghadiyaram

3 Answers

1
votes

please see the example configuration like below if you are missing anything like hadoop.security.authentication

val conf= HBaseConfiguration.create()
conf.set("hbase.zookeeper.quorum", "list of ip's")
conf.set("hbase.zookeeper"+ ".property.clientPort","2181");
conf.set("hbase.master", "masterIP:60000");
conf.set("hadoop.security.authentication", "kerberos");
0
votes

Actually try to put your hbase-site.xml directly in the SPARK_CONF directory of your edge node (should be something like /etc/spark/conf or /etc/spark2/conf).

0
votes

you can use loginUserFromKeytabAndReturnUGI, and uig.doAs

or you could put you hbase classpath to SPARK_DIST_CLASSPATH.