编程方式确定核心数量和可用内存量星火 [英] Programmatically determine number of cores and amount of memory available to Spark

查看:150
本文介绍了编程方式确定核心数量和可用内存量星火的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

星火Web UI中显示有关可用资源集群作为一个整体了一些有趣的信息。

The Spark Web UI shows some interesting information about the resources available to the cluster as a whole.

我在值特别感兴趣:



  • 内核

  • 内存

我如何可以查询这些信息对整体集群编程?

How can I query these pieces of information about the overall cluster programmatically?

推荐答案

星火并没有真正揭露这种信息的,这一切都隐藏在主并转移到WebUI的。

Spark doesn't really expose this kind of info, it's all hidden in the Master and transferred to the WebUI.

您可以使用,无论小黑客,在WebUI JSON支持通过追加/ JSON /到一个页面。

You can however use a small hack, the WebUI supports JSON by appending /json/ to a page.

所以,要的http://<掌握主机>:<主端口> / JSON / 将返回只是你正在寻找的信息

So, going to http://<master-host>:<master-port>/json/ will return just the info you're looking for:

{
  url: "spark://<host>:<port>",
  workers: [ ],
  cores: 0,
  coresused: 0,
  memory: 0,
  memoryused: 0,
  activeapps: [ ],
  completedapps: [ ],
  activedrivers: [ ],
  status: "ALIVE"
}

这篇关于编程方式确定核心数量和可用内存量星火的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆