hadoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreina j <andrein...@huawei.com>
Subject RE: Authenticating to Kerberos enabled Hadoop cluster using Java
Date Mon, 02 Nov 2015 11:27:22 GMT
Hi Chhaya,

Please find below sample code .

  System.setProperty("java.security.krb5.conf", "D:\\data\\Desktop\\cluster-test\\krb5.conf<file:///\\data\Desktop\cluster-test\krb5.conf>");

// Login using keytab if have access to keytab. else
       "  D:\\data\\Desktop\\cluster-test\\conf\\hdfs.keytab<file:///\\data\Desktop\cluster-test\conf\hdfs.keytab>");

Note: Above 2 lines should be at the beginning  in your application.

Andreina J

From: Vishwakarma, Chhaya [mailto:Chhaya.Vishwakarma@Thinkbiganalytics.com]
Sent: 02 November 2015 PM 04:20
To: user@hadoop.apache.org
Subject: RE: Authenticating to Kerberos enabled Hadoop cluster using Java

Thanks Niranjan It would be great if you can share a sample code if any?

From: Niranjan Subramanian [mailto:niranjan@webaction.com]
Sent: 02 November 2015 16:18
To: user@hadoop.apache.org<mailto:user@hadoop.apache.org>
Subject: Re: Authenticating to Kerberos enabled Hadoop cluster using Java

Hi Chhaya,

You can use the UserGroupInformation class from org.apache.hadoop.security package.

Specifically following 2 methods of that class

UserGroupInformation.loginUserFromKeytab(principal, keytabPath);


On 02-Nov-2015, at 4:15 pm, Vishwakarma, Chhaya <Chhaya.Vishwakarma@Thinkbiganalytics.com<mailto:Chhaya.Vishwakarma@Thinkbiganalytics.com>>

I have Kerberos enabled Hadoop cluster, I need to perform HDFS operations using JAVA code.

I have keytab file and username can someone please suggest how can I autheticate to Kerberos
using JAVA code?

View raw message