如何从命令行向 Hadoop 进行身份验证?删除“ls: SIMPLE authentication is not enabled”错误

How to authenticate to Hadoop from command line? Removing `ls: SIMPLE authentication is not enabled` error

我正在 Hadoop 集群上设置 Kerberos 身份验证。在集群外的一台机器上,每当我执行 hadoop fs -ls 时,我都会收到以下消息:ls: SIMPLE authentication is not enabled. Available:[TOKEN, KERBEROS],这很好,因为这就是我想要的。但现在我的问题是,我如何真正成功地执行该命令?我知道如果我不进行身份验证我将无法继续,但是如何从命令行进行身份验证?

尝试以下步骤

Server

kadmin.local
addprinc user@realm.com

Client

kinit user@realm.com

klist 查看校长

需要在 Hadoop 服务器和尝试访问它的客户端中进行修改。

服务器

在服务器中,您需要向领域添加一个新用户,为此您使用以下命令:

kadmin.local shell 中,键入以下命令:addprinc user@realm.com。出现提示时,输入密码两次。

客户端

确保您已安装 kinit 并指向集群的 Kerberos 服务器,并且 运行 以下命令从 Kerberos 服务器获取令牌:kinit user@realm.com。要验证您是否成功获取它,请键入 klist.

最后但同样重要的是:确保您的客户端 core-site.xml 文件与相应的服务器端配置一致。特别是,如果在您的服务器中不是 simple,请确保密钥 hadoop.security.authentication 的值在您的客户端中不是 simple