小编quu*_*x00的帖子

客户端无法通过以下方式进行身份验证:[TOKEN, KERBEROS]

我正在使用 YarnClient 以编程方式启动作业。我正在运行的集群已进行 Kerberos 化。

通过“yarn jar Examples.jar wordcount...”提交的法线贴图缩减作业工作。

我尝试以编程方式提交的作业却没有。我收到此错误:

14/09/04 21:14:29 错误 client.ClientService:应用程序提交期间发生错误:应用程序 application_1409863263326_0002 由于 appattempt_1409863263326_0002_000002 的 AM 容器退出,退出代码:-1000,原因是:本地异常失败:java.io。 IOException:org.apache.hadoop.security.AccessControlException:客户端无法通过以下方式进行身份验证:[TOKEN,KERBEROS];主机详细信息:本地主机为:“yarn-c1-n1.clouddev.snaplogic.com/10.184.28.108”;目标主机是:“yarn-c1-cdh.clouddev.snaplogic.com”:8020;.这次尝试失败..申请失败。14/09/04 21:14:29 错误 client.YClient:应用程序提交失败

代码看起来像这样:

ClientContext context = createContextFrom(args);
YarnConfiguration configuration = new YarnConfiguration();
YarnClient yarnClient = YarnClient.createYarnClient();
yarnClient.init(configuration);
ClientService client = new ClientService(context, yarnClient, new InstallManager(FileSystem.get(configuration)));
LOG.info(Messages.RUNNING_CLIENT_SERVICE);
boolean result = client.execute();
Run Code Online (Sandbox Code Playgroud)

我原以为也许添加一些东西可以达到以下效果:

yarnClient.getRMDelegationToken(new Text(InetAddress.getLocalHost().getHostAddress()));
Run Code Online (Sandbox Code Playgroud)

也许可以减轻我的痛苦,但这似乎也没有帮助。任何帮助将不胜感激。

hadoop cloudera hadoop-yarn kerberos-delegation

5
推荐指数
1
解决办法
3万
查看次数

如何用Java创建Kafka ZKStringSerializer?

在搜索如何通过API创建Kafka主题时,我在Scala中找到了这个示例:

import kafka.admin.AdminUtils
import kafka.utils.ZKStringSerializer
import org.I0Itec.zkclient.ZkClient

// Create a ZooKeeper client
val sessionTimeoutMs = 10000
val connectionTimeoutMs = 10000
val zkClient = new ZkClient("zookeeper1:2181", sessionTimeoutMs,
                            connectionTimeoutMs, ZKStringSerializer)

// Create a topic with 8 partitions and a replication factor of 3
val topicName = "myTopic"
val numPartitions = 8
val replicationFactor = 3
val topicConfig = new Properties
AdminUtils.createTopic(zkClient, topicName, 
                       numPartitions, replicationFactor, topicConfig)
Run Code Online (Sandbox Code Playgroud)

资料来源:https://stackoverflow.com/a/23360100/871012

最后一个arg ZKStringSerializer显然是一个Scala对象.我不清楚如何使这个例子在Java中工作.

这篇文章如何在clojure中创建一个scala对象在Clojure中提出同样的问题,答案是:

ZKStringSerializer$/MODULE$
Run Code Online (Sandbox Code Playgroud)

在Java中我会(我认为)转换为:

ZKStringSerializer$.MODULE$
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试(或任何其他数量的变化)时,他们都没有编译.
编译错误是:

KafkaTopicCreator.java:[16,18] cannot …
Run Code Online (Sandbox Code Playgroud)

java scala apache-kafka

5
推荐指数
1
解决办法
3666
查看次数

在 Rust 中,有没有办法将结构/类型更改为“发送”?

我已经多次尝试将内容传递给spawn函数(以创建新线程/任务)并让编译器告诉我这个问题error: cannot capture variable of type "blah blah", which does not fulfill "Send", in a bounded closure。

有没有办法转换类型能够满足“发送”或基于某些规则集固定?

例如,我可以ToStr使用这样的指令轻松实现trait:

#[deriving(ToStr, Rand)]
struct Point {
    x: int,
    y: int,
}
Run Code Online (Sandbox Code Playgroud)

我可以为Send特征做类似的事情吗?还是“善良”的特质被区别对待?

这是这个问题的一个具体例子 -有什么方法可以克服它吗?

fn create_process_options(cmdinfo: &CmdInfo) -> (ProcessOptions, Option<FileDesc>) {
// ... omitted
}

// "po" is of type std::run::ProcessOptions
let (po, filedesc_opt) = create_process_options(&cmdinfo);
spawn(proc() {
    let mut ps = Process::new(cmdinfo.program, cmdinfo.args, po).expect("darn");
    ps.finish();
});
Run Code Online (Sandbox Code Playgroud)

编译器错误:

error: cannot capture variable of …
Run Code Online (Sandbox Code Playgroud)

rust

3
推荐指数
1
解决办法
2521
查看次数

使用 Java Apache HttpClient Fluent API 进行 Cookie 管理

我无法弄清楚如何使用 Apache HttpComponents/HttpClient Fluent API 并让它正确地将 cookie 发送回需要登录的 Web 服务器,然后发送回 cookie 以访问网站的其他部分。我使用的是4.5.3版本。

根据 Fluent API 教程,您可以使用 (HttpComponents) 执行器“以便在特定的安全上下文中执行请求,从而缓存身份验证详细信息并重新用于后续请求”。https://hc.apache.org/httpcomponents-client-4.5.x/tutorial/html/ Fluent.html

所以我尝试了,但在登录后尝试访问另一个页面时,我收到 403 访问被拒绝。这是我尝试过的代码:

CookieStore httpCookieStore = new BasicCookieStore();
List<Cookie> cookies = httpCookieStore.getCookies();

String username = "admin";
String password = "admin";
Executor httpExecutor = Executor.newInstance().auth(username, password);
httpExecutor.use(httpCookieStore);
Response response = httpExecutor.execute(Request.Get("http://myserver.example.com/login").useExpectContinue());
String loginOutput = response.returnContent().asString();
System.out.println(loginOutput);  // works - gets the expected page

String swaggerUrl = "http://myserver.example.com/swagger/index.html";
response = httpExecutor.execute(Request.Get(swaggerUrl));
HttpResponse httpResponse = response.returnResponse();
System.out.println(httpResponse);  // Response is 403 Access Denied …
Run Code Online (Sandbox Code Playgroud)

java cookies

3
推荐指数
1
解决办法
3430
查看次数