libhdfs3
libhdfs3 copied to clipboard
hdfsBuilderSetPrincipal doesn't work
Hi Team, I got an error like this :
2021-03-14 14:10:20.339761, p16581, th139969607461248, INFO Retrying connect to server: "hadoopc1h5:25000". Already tried 9 time(s)
2021-03-14 14:10:22.359599, p16581, th139969607461248, ERROR Failed to setup RPC connection to "hadoopc1h5:25000" caused by:
RpcChannel.cpp: 747: Problem with callback handler
@ Hdfs::Internal::UnWrapper<Hdfs::SafeModeException, Hdfs::SaslException, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing>::unwrap(char const*, int)
@ Hdfs::Internal::UnWrapper<Hdfs::AccessControlException, Hdfs::SafeModeException, Hdfs::SaslException, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing>::unwrap(char const*, int)
@ Hdfs::Internal::UnWrapper<Hdfs::UnsupportedOperationException, Hdfs::AccessControlException, Hdfs::SafeModeException, Hdfs::SaslException, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing>::unwrap(char const*, int)
@ Hdfs::Internal::UnWrapper<Hdfs::RpcNoSuchMethodException, Hdfs::UnsupportedOperationException, Hdfs::AccessControlException, Hdfs::SafeModeException, Hdfs::SaslException, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing>::unwrap(char const*, int)
@ Hdfs::Internal::UnWrapper<Hdfs::NameNodeStandbyException, Hdfs::RpcNoSuchMethodException, Hdfs::UnsupportedOperationException, Hdfs::AccessControlException, Hdfs::SafeModeException, Hdfs::SaslException, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing, Hdfs::Internal::Nothing>::unwrap(char const*, int)
@ Hdfs::Internal::HandlerRpcResponseException(std::__exception_ptr::exception_ptr)
@ Hdfs::Internal::RpcChannelImpl::readOneResponse(bool) [clone .cold]
@ Hdfs::Internal::RpcChannelImpl::setupSaslConnection()
@ Hdfs::Internal::RpcChannelImpl::connect()
@ Hdfs::Internal::RpcChannelImpl::invokeInternal(std::shared_ptr<Hdfs::Internal::RpcRemoteCall>)
@ Hdfs::Internal::RpcChannelImpl::invoke(Hdfs::Internal::RpcCall const&)
@ Hdfs::Internal::NamenodeImpl::invoke(Hdfs::Internal::RpcCall const&)
@ Hdfs::Internal::NamenodeImpl::getFsStats()
@ Hdfs::Internal::NamenodeProxy::getFsStats()
@ Hdfs::Internal::FileSystemImpl::getFsStats()
@ Hdfs::Internal::FileSystemImpl::connect()
@ Hdfs::FileSystem::connect(char const*, char const*, char const*)
@ hdfsBuilderConnect
@ main
@ __libc_start_main
@ Unknown
and my code and hdfs conf :
int main() {
hdfsBuilder* builder = hdfsNewBuilder();
hdfsBuilderSetNameNode(builder, schemaAddress.c_str());
hdfsBuilderSetForceNewInstance(builder);
hdfsBuilderSetPrincipal(builder, "ossuser");
std::stringstream ss;
ss.imbue(std::locale::classic());
ss << "/tmp/krb5cc_0";
std::cout << ss.str() << std::endl;
const char * userCCpath = GetEnv("LIBHDFS3_TEST_USER_CCPATH", ss.str().c_str());
hdfsBuilderSetKerbTicketCachePath(builder, userCCpath);
hdfsFS hdfs = hdfsBuilderConnect(builder);
if (!hdfs) {
die("Could not connect to HDFS server \"" << schemaAddress << "\": " << thrill::vfs::HdfsGetLastError());
}
std::cout << "success connect to hdfs!!!!!!!!!!!" << std::endl;
return 1;
}
hdfs-client.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- RPC client configuration -->
<property>
<name>hadoop.security.authentication</name>
<value>kerberos</value>
<description>
the RPC authentication method, valid values include "simple" or "kerberos". default is "simple"
</description>
</property>
</configuration>
klist shows:
Ticket cache: FILE:/tmp//krb5cc_0
Default principal: [email protected]
Valid starting Expires Service principal
03/14/21 14:09:56 03/15/21 14:09:56 krbtgt/[email protected]
03/14/21 14:10:05 03/15/21 14:09:56 hdfs/[email protected]
Am I use the hdfsBuilderSetPrincipal in the wrong way? Can you please give me some example or reference how to use libhdfs3 to connect kerberized cluster?
Appreciate your support! Thanks!
were you able to solve it?
Any progress?