Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hdfsBuilderSetPrincipal doesn't work #11

Open
youngfn opened this issue Mar 14, 2021 · 2 comments
Open

hdfsBuilderSetPrincipal doesn't work #11

youngfn opened this issue Mar 14, 2021 · 2 comments

Comments

@youngfn
Copy link

youngfn commented Mar 14, 2021

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!

@thegeekyboy
Copy link

were you able to solve it?

@zhanglistar
Copy link
Contributor

Any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants