mesos

独孤九剑-Spark面试80连击(下)

穿精又带淫゛_ 提交于 2019-11-29 02:47:08
By 大数据技术与架构 场景描述: 这是一个Spark的面试题合集。是我自己作为面试者和作为面试官都会被问到或者问到别人的问题,这个总结里面有大量参考了网上和书上各位老师、大佬的一些原文答案,只是希望可以给出更好的回答,一般上我都会把原文链接贴上,如有侵权请联系删除! 再次感谢各位提供的资料,如果你有一定的 Spark 基础,但是经常在面试中表现不佳,那么这篇总结应该非常适合你! 关键词: Spark 面试题 书接: 《独孤九剑-Spark面试80连击(上)》 订正: 第37题题目应为:说说Spark的WAL(预写日志)机制? Spark SQL和Structured Streaming会另起专题介绍, 欢迎持续关注。 39. Spark的UDF? 因为目前 Spark SQL 本身支持的函数有限,一些常用的函数都没有,比如 len, concat...etc 但是使用 UDF 来自己实现根据业务需要的功能是非常方便的。Spark SQL UDF 其实是一个 Scala 函数,被 catalyst 封装成一个 Expression 结点,最后通过 eval 方法计根据当前 Row 计算 UDF 的结果。UDF 对表中的单行进行转换,以便为每行生成单个对应的输出值。例如,大多数 SQL 环境提供 UPPER 函数返回作为输入提供的字符串的大写版本。 用户自定义函数可以在 Spark

Spark+Docker的集群模式

烈酒焚心 提交于 2019-11-28 20:58:14
Spark支持local、Standalone和Cluster三种并行运行模式【参考: Spark的三种运行模式快速入门 】。 local,单机运行模式。 Standalone,Spark自己构建的独立集群。 Cluster,运行在Mesos/YARN/Kubernetes等集群环境中,从而可以让Spark与其他的应用协调资源。 参考: 搭建hadoop/spark集群环境 使用Mesos和Marathon管理Docker集群 Docker作为应用“集装箱”,提供了Swarm集群运行环境( 最新版为swarmkit,参考: Docker文档 ),也可以运行于Mesos/Kubernetes等集群环境中。 将Spark部署于Docker中,可以提供单机运行和手动的Standalone运行,也可以同时支持Swarm/Mesos/YARN/Kubernetes集群环境。 部署方式: 1、需要将Spark分为Master和Slave两种部署模式,创建两类Spark容器(或者创建为一个通用容器,通过启动参数判断节点将启动为Master还是Slave模式)。 2、通过启动参数环境变量将Spark启动参数传递进Docker。 3、在容器启动时,设置Spark节点启动,并且Slave节点自动连接到Master节点。 理论上,可以在一个Docker中启动多个Spark节点

Setting up a docker / fig Mesos environment

会有一股神秘感。 提交于 2019-11-28 18:27:33
I'm trying to set up a docker / fig Mesos cluster. I'm new to fig and Docker. Docker has plenty of documentation, but I find myself struggling to understand how to work with fig. Here's my fig.yaml at the moment: zookeeper: image: jplock/zookeeper ports: - "49181:2181" mesosMaster: image: mesosphere/mesos:0.19.1 ports: - "15050:5050" links: - zookeeper:zk command: mesos-master --zk=zk --work_dir=/var/log --quorum=1 mesosSlave: image: mesosphere/mesos:0.19.1 links: - zookeeper:zk command: mesos-slave --master=zk Thanks ! Edit: Thanks to Mark O`Connor's help, I've created a working docker-based

Can apache spark run without hadoop?

眉间皱痕 提交于 2019-11-28 15:24:49
Are there any dependencies between Spark and Hadoop ? If not, are there any features I'll miss when I run Spark without Hadoop ? Spark can run without Hadoop but some of its functionality relies on Hadoop's code (e.g. handling of Parquet files). We're running Spark on Mesos and S3 which was a little tricky to set up but works really well once done (you can read a summary of what needed to properly set it here ). (Edit) Note: since version 2.3.0 Spark also added native support for Kubernetes Ravindra babu Spark is an in-memory distributed computing engine. Hadoop is a framework for distributed

使用Mesos和Marathon管理Docker集群

你。 提交于 2019-11-28 12:57:00
分布式系统是难于理解、设计、构建 和管理的,他们将比单个机器成倍还要多的变量引入到设计中,使应用程序的根源问题更难发现。SLA(服务水平协议)是衡量停机和/或性能下降的标准,大多数现代应用程序有一个期望的弹性SLA水平,通常按"9"的数量增加(如,每月99.9或99.99%可用性)。每个额外的9变得越来越难实现。   分布式系统通常是以静态分区,比如Akka/Play、 Spark/Hadoop、Storm和 Redis各自分区分组划分。静态分区带来的缺点是增加复杂性,随着机器数量增加,软件管理越来越复杂,失败管理维护越来越难。而且资源消耗非常不经济,下图是静态分区下资源利用率:   Apache Mesos能够在同样的集群机器上运行多种分布式系统类型,更加动态有效率低共享资源。提供失败侦测,任务发布,任务跟踪,任务监控,低层次资源管理和细粒度的资源共享,可以扩展伸缩到数千个节点。Mesos已经被Twitter用来管理它们的数据中心。 Mesos架构图如下:   Mesos框架是一个在Mesos上运行分布式应用的应用程序,它有两个组件: 调度器 : 与Mesos交互,订阅资源,然后在mesos从服务器中加载任务。 执行器 : 从框架的环境变量 配置中获得信息,在mesos从服务器中运行任务。   下面看看其是如何实现资源调用?Mesos通过"resources offers"

How to pre-package external libraries when using Spark on a Mesos cluster

三世轮回 提交于 2019-11-28 11:13:38
According to the Spark on Mesos docs one needs to set the spark.executor.uri pointing to a Spark distribution: val conf = new SparkConf() .setMaster("mesos://HOST:5050") .setAppName("My app") .set("spark.executor.uri", "<path to spark-1.4.1.tar.gz uploaded above>") The docs also note that one can build a custom version of the Spark distribution. My question now is whether it is possible/desirable to pre-package external libraries such as spark-streaming-kafka elasticsearch-spark spark-csv which will be used in mostly all of the job-jars I'll submit via spark-submit to reduce the time sbt

Which cluster type should I choose for Spark?

余生长醉 提交于 2019-11-27 16:56:57
I am new to Apache Spark, and I just learned that Spark supports three types of cluster: Standalone - meaning Spark will manage its own cluster YARN - using Hadoop's YARN resource manager Mesos - Apache's dedicated resource manager project Since I am new to Spark, I think I should try Standalone first. But I wonder which one is the recommended. Say, in the future I need to build a large cluster (hundreds of instances), which cluster type should I go to? I think the best to answer that are those who work on Spark. So, from Learning Spark Start with a standalone cluster if this is a new

Apache Spark on Mesos: Initial job has not accepted any resources

泄露秘密 提交于 2019-11-27 15:21:25
I am running Apache Spark on cluster mode using Apache Mesos. But, when I start Spark-Shell to run a simple test command (sc.parallelize(0 to 10, 8).count) I receive the following warning message: 16/03/10 11:50:55 WARN TaskSchedulerImpl: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources If I check on Mesos WebUI I can see that Spark-Shell is listed as a framework and I have listed one slave (my own machine). Any help how to troubleshoot it? While most of other answers focuses on resource allocation (cores,

Mesos资源调度器的实现分析

末鹿安然 提交于 2019-11-27 13:07:50
<h3>1 mesos DRF介绍</h3> <p>mesos调度器是根据DRF(dominant resource fairness)算法实现的。DRF算法背后的直观想法是在多资源类型的环境下,一个用户的资源分配应该由用户的dominant share(主导份额的资源)决定,dominant share是在所有已经分配给用户的多种资源中,占据最大份额的一种资源。</p> <p>mesos使用resource offers的方式实现各个框架之间的资源分配。Resource offer是多个slave节点上的一组空闲资源。Master根据调度策略来决定提供多少资源给每一个framework,通过以Resource offer的形式发送给发送给框架,然后框架响应Resource offer,确认Resource offer中已使用的资源和返回剩余的空闲资源。</p> <p>mesos的资源分配器是一个分层的加权max-min fairness的实现。通过抽象了一个role概念,将framework按照role进行分组。那么资源分配就可以分为两层:首先是在各个框架群组间通过加权的DRF算法进行排序;其次在框架群组内部,对各个framework使用加权DRF算法进行排序。然后按照最终的排序结果,从小到大对各个框架进行Resource Offer。如下图所示。</p> <p><a href=

Setting up a docker / fig Mesos environment

[亡魂溺海] 提交于 2019-11-27 11:34:29
问题 I'm trying to set up a docker / fig Mesos cluster. I'm new to fig and Docker. Docker has plenty of documentation, but I find myself struggling to understand how to work with fig. Here's my fig.yaml at the moment: zookeeper: image: jplock/zookeeper ports: - "49181:2181" mesosMaster: image: mesosphere/mesos:0.19.1 ports: - "15050:5050" links: - zookeeper:zk command: mesos-master --zk=zk --work_dir=/var/log --quorum=1 mesosSlave: image: mesosphere/mesos:0.19.1 links: - zookeeper:zk command: