Spark 3.5.0 独立部署(Standalone)模式

1.下载Spark 3.5.0

https://spark.apache.org/downloads.html

2.安装JDK

Linux 安装Openjdk

3.安装Hadoop

Hadoop-3.3.6分布式集群搭建步骤

4.解压

mkdir /usr/spark
tar -zxvf spark-3.5.0-bin-hadoop3.tgz -C /usr/spark/

5.配置

1.修改集群节点配置,添加节点

cd /usr/spark/spark-3.5.0-bin-hadoop3/conf
mv workers.template workers
vi workers
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# A Spark Worker will be started on each of the machines listed below.
localhost
192.168.58.131
192.168.58.132

2.配置Java环境变量

mv spark-env.sh.template spark-env.sh
vi spark-env.sh
export JAVA_HOME=/usr/java/jdk8u392-b08
SPARK_MASTER_HOST=192.168.58.130
SPARK_MASTER_PORT=7077

3.为所有节点同步配置【略】

6.启动

/usr/spark/spark-3.5.0-bin-hadoop3/sbin/start-all.sh

7.访问WebUI

http://192.168.58.130:8080/

8.跑一个内置的测试任务

bin/spark-submit --class org.apache.spark.examples.SparkPi --master spark://192.168.58.130:7077 ./examples/jars/spark-examples_2.12-3.5.0.jar 10
posted @ 2023-12-31 18:21  SpringCore  阅读(210)  评论(0编辑  收藏  举报