authentication - 在 Apache hadoop 2.x 中。当前的 UserGroupInformation 是否会在子线程中丢失凭据?
问题描述
这是我用来演示问题的简单实验,用 scala 编写,Hadoop 2.7.7 作为唯一依赖项:
import org.apache.hadoop.security.UserGroupInformation
import scala.concurrent.duration.{Duration, MINUTES}
import scala.concurrent.{Await, ExecutionContext, Future}
object UGITest {
val ugi = UserGroupInformation.getCurrentUser
val credential = ugi.getCredentials
val ff = Future {
val _ugi = UserGroupInformation.getCurrentUser
val _credential = _ugi.getCredentials
require(ugi == _ugi, s"UGI is lost, before: $ugi, now ${_ugi}")
require(credential == _credential, s"credential is lost, before: $credential, now ${_credential}")
}(ExecutionContext.global)
Await.result(ff, Duration.apply(1, MINUTES))
}
第一个需求ugi==_ugi
成功通过,说明Future
在子线程中成功启动了 的关闭。
第二个要求credential==_credential
失败并显示以下信息:
java.lang.IllegalArgumentException: requirement failed: credential is lost, before: org.apache.hadoop.security.Credentials@cb6e68f, now org.apache.hadoop.security.Credentials@6b746674
at scala.Predef$.require(Predef.scala:281)
at ...
似乎使用了相同的 UserGroupInformation,但所有凭据都丢失了。这个设计的目的是什么?
上述实验只是在一台计算机上执行,而不是在任何集群中。我没有使用任何启用的hadoop 身份验证框架(例如kerberos)对其进行测试。但我认为结果或多或少是一样的。
解决方案
推荐阅读
- javascript - 与 Kenwood TH-D72A 的串行端口通信似乎几乎是不可能的。为什么我不能使用 javascript 读取数据?
- dart - 在 Dart 中使用 DTLS
- ascii - 如何编写qb64项目符号
- javascript - 在reactjs材料ui进度条中显示百分比数字
- php - 在 Laravel 中使用 DB::raw 时出现奇怪的是 null
- node.js - 生成的校验和 md5 值不匹配
- windows - Windows / 在新进程中打开应用程序并调整大小
- java - 将单元格颜色更改为特定定义的颜色
- neural-network - unable to add layer in keras
- d3.js - 创建反向 D3 堆栈条形图