我正在尝试创建一个非托管 ApplicationMaster 并且在正确创建 AMRMtokens 时遇到问题。我查看了 TestAMRMtokens.java 测试用例,这就是我想出的。(这是scala代码)
def getNextAttemptid() : ApplicationAttemptId = {
val t = java.lang.System.currentTimeMillis()
ConverterUtils.toApplicationAttemptId(ConverterUtils.APPLICATION_ATTEMPT_PREFIX + "_" + t.toString() + "_0001" + "_0001")
}
appAttemptId = getNextAttemptid()
UserGroupInformation.setConfiguration(yarnConf)
val ugi = UserGroupInformation.getCurrentUser()
val tokenIdentifier = new AMRMTokenIdentifier(appAttemptId)
val secretManager = new AMRMTokenSecretManager(yarnConf)
val token: Token[_ <: TokenIdentifier] = new Token[AMRMTokenIdentifier](tokenIdentifier, secretManager)
ugi.addToken(token)
amClient = AMRMClient.createAMRMClient()
amClient.init(yarnConf)
amClient.start()
val appMasterResponse = amClient.registerApplicationMaster("localhost", 0, "")
Yarn 不喜欢这个要求并说:
2014-01-27 10:47:10,938 WARN SecurityLogger.org.apache.hadoop.ipc.Server: 127.0.0.1:63085:null 的身份验证失败(DIGEST-MD5:获取密码的 IO 错误)2014-01-27 10: 47:10,938 INFO org.apache.hadoop.ipc.Server:8030 上的 IPC 服务器侦听器:来自客户端 127.0.0.1 的 readAndProcess 引发异常 [org.apache.hadoop.security.token.SecretManager$InvalidToken:找不到 ApplicationAttempt appattempt_1390848430314_0001_000001 的密码]
我确定我做错了什么。是否有说明如何正确创建令牌的文档或示例代码?我是否必须在 Yarn/Hadoop 配置中的某个地方设置这些用户。
配置:
- Hadoop 2.2.0
- 所有服务都在 localhost 接口上侦听只需使用开箱即用的配置。没有特别的变化。