New Contributor
Posts: 1
Registered: ‎03-21-2017

Accessing HDFS on Cloudera with Java and Kerberos Keytab from Windows

[ Edited ]

Hi all,

I'm trying to connect to my HDFS instance running on Cloudera. My first step was enabling Kerberos and creating Keytabs (as shown here). In the next step i would like to authenticate with a keytab using eclipse on Windows.



Configuration conf = new Configuration();
conf.set("fs.defaultFS", "hdfs://cloudera:8020");
conf.set("", "kerberos");

UserGroupInformation.loginUserFromKeytab("hdfs@CLOUDERA", "/etc/hadoop/conf/hdfs.keytab");

FileSystem fs = FileSystem.get(conf);
FileStatus[] fsStatus = fs.listStatus(new Path("/"));
for (int i = 0; i < fsStatus.length; i++) {

It fails with the following error: Login failure for hdfs@CLOUDERA from keytab /etc/hadoop/conf/hdfs.keytab: Unable to obtain password from user


The question is: how to I correctly handle the keytab? Do i have to copy it to my local machine? Do I have to install a Kerberos Client on Windows?


Thanks in advance and best regards!