168大数据

标题: Spark的Standalone模式安装部署 [打印本页]

作者: 168主编    时间: 2018-8-16 10:19
标题: Spark的Standalone模式安装部署
Spark运行模式

Spark 有很多种模式,最简单就是单机本地模式,还有单机伪分布式模式,复杂的则运行在集群中,目前能很好的运行在 Yarn和 Mesos 中,当然 Spark 还有自带的 Standalone 模式,对于大多数情况 Standalone 模式就足够了,如果企业已经有 Yarn 或者 Mesos 环境,也是很方便部署的。

Spark Standalone集群部署准备工作部署配置

这里配置工作需要以下几个步骤:

下面具体说明一下:

其他选项内容请参照下面的选项说明:

1
2
3
4
5
6
7
8
9
10
11
# Options for the daemons used in the standalone deploy mode:
# - SPARK_MASTER_IP, to bind the master to a different IP address or hostname
# - SPARK_MASTER_PORT / SPARK_MASTER_WEBUI_PORT, to use non-default ports for the master
# - SPARK_MASTER_OPTS, to set config properties only for the master (e.g. "-Dx=y")
# - SPARK_WORKER_CORES, to set the number of cores to use on this machine
# - SPARK_WORKER_MEMORY, to set how much total memory workers have to give executors (e.g. 1000m, 2g)
# - SPARK_WORKER_PORT / SPARK_WORKER_WEBUI_PORT, to use non-default ports for the worker
# - SPARK_WORKER_INSTANCES, to set the number of worker processes per node
# - SPARK_WORKER_DIR, to set the working directory of worker processes
# - SPARK_WORKER_OPTS, to set config properties only for the worker (e.g. "-Dx=y")
# - SPARK_HISTORY_OPTS, to set config properties only for the history server (e.g. "-Dx=y")

Spark Client部署

Spark Client的作用是,事先搭建起Spark集群,然后再物理机上部署客户端,然后通过该客户端提交任务给Spark集群。
由于上面介绍了Standalone分布式集群是如何搭建的,这里只需将集群上的spark文件夹拷贝过来。
最简单的Spark客户端访问集群的方式就是通过Spark shell的方式:bin/spark-shell --master spark://hadoop1:7077这样就可以访问集群了。
这样在浏览器的Spark集群界面上就可以看到Running Applications一栏中有Spark shell的应用在执行。

Spark Standalone伪分布式部署

伪分布式是在一台机器上进行部署来模拟分布式的集群,这里部署的过程和Standalone集群的部署是类似的,事前的工作都是一样的,这里只是在配置文件中做相应的修改就可以了。

这里还是配置这两个文件:

配置conf/spark-env.sh文件
配置conf/slave文件






欢迎光临 168大数据 (http://bi168.cn/) Powered by Discuz! X3.2