Всем дорого дня.
Третий день бьюсь надо проблемой никак не могу понять, что же не так. Есть НADOOP и соответственно HDFS в котором лежат файлы, необходимо писать файлы в HDFS напрямую с локальных машины(в том числе и Windows), минуя запись файлов на машины где непосредственно развернут HDFS. Дополнительно на кластере включена аутентификация по средствам kerberos.
Для проверки написал вот такой код под Windows:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
System.setProperty("jaas.conf");
System.setProperty("krb5.conf");
UsernamePasswordHandler passHandler = new UsernamePasswordHandler("hdfs", "hdfspass");
LoginContext loginContextHadoop = new LoginContext("Client", passHandler);
loginContextHadoop.login();
Configuration configuration = new Configuration();
configuration.set("hadoop.security.authentication", "Kerberos");
configuration.addResource(new Path("core-site.xml"));
configuration.set("fs.default.name", "hdfs://xxx.xxx.xxx.xxx:50020");
org.apache.hadoop.security.UserGroupInformation.setConfiguration(configuration);
org.apache.hadoop.security.UserGroupInformation.loginUserFromSubject(loginContextHadoop.getSubject());
System.out.println(org.apache.hadoop.security.UserGroupInformation.isLoginTicketBased());
FileSystem hdfs = FileSystem.get(configuration);
Path file = new Path("test.txt");
System.out.println(file.getName());
System.out.println(hdfs.getClass());
if(hdfs.exists(file))
System.out.println("File exists");
hdfs.close();
В результате в output получаю ошибку:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
true
test.txt
class org.apache.hadoop.hdfs.DistributedFileSystem
org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.RpcNoSuchProtocolException): Unknown protocol: org.apache.hadoop.hdfs.protocol.ClientProtocol
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.getProtocolImpl(ProtobufRpcEngine.java:557)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:596)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1073)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2086)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2082)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1709)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2080)
at org.apache.hadoop.ipc.Client.call(Client.java:1475)
at org.apache.hadoop.ipc.Client.call(Client.java:1412)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229)
at com.sun.proxy.$Proxy9.getFileInfo(Unknown Source)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo(ClientNamenodeProtocolTranslatorPB.java:771)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:191)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
at com.sun.proxy.$Proxy10.getFileInfo(Unknown Source)
at org.apache.hadoop.hdfs.DFSClient.getFileInfo(DFSClient.java:2108)
at org.apache.hadoop.hdfs.DistributedFileSystem$22.doCall(DistributedFileSystem.java:1305)
at org.apache.hadoop.hdfs.DistributedFileSystem$22.doCall(DistributedFileSystem.java:1301)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1317)
at org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1426)
at CImpalaOperations.main(CImpalaOperations.java:68)
Никак не могу понять, что я делаю не так?