I have a java application which needs to access Hadoop cluster to fetch a file at regular intervals(say, every 24 hours).
Since Kerberos protocol is enabled for protection on that cluster, I am using loginUserFromKeytab() method of UserGroupInformation class : https://hadoop.apache.org/docs/r1.2.1/api/org/apache/hadoop/security/UserGroupInformation.html.
Now, I know that kinit command grants a ticket-granting ticket to access any Kerberized service and this ticket has to be refreshed periodically(through kinit command). Now, my question is, is it required to run kinit periodically(from code) in combination with the above Java API for the code to work? Or will running it once be sufficient? Or is it not required at all.
Thanks for reading.
It's a long and complicated story. In short:
loginUserFromKeytab(), then that ticket is not renewable; you must launch a background thread to call checkTGTAndReloginFromKeytab() from time to time, and it will re-create the ticket whenever it comes close to expirationSome recommended readings:
- HBase Kerberos connection renewal strategy
- Should I call ugi.checkTGTAndReloginFromKeytab() before every action on hadoop?
- Auto renewal of Kerberos ticket not working from Java (i.e. there's a bug in the non-static methods of UGI)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With