1 准备环境

192.168.0.251 shulaibao1 
192.168.0.252 shulaibao2 
hadoop-2.8.0-bin 
spark-2.1.1-bin-hadoop2.7 
关闭selinux: 
/etc/selinux/config:SELINUX=disabled

增加hadoop用户组与用户

groupadd−g1000hadoopuseradd -u 2000 -g hadoop hadoop 
mkdir−p/home/data/app/hadoopchown -R hadoop:hadoop /home/data/app/hadoop 
$passwd hadoop

配置无密码登录

ssh−keygen−trsacd /home/hadoop/.ssh cpidrsa.pubauthorizedkeyshadoop1scp authorized_keys_hadoop2 
hadoop@hadoop1:/home/hadoop/.ssh scpauthorizedkeyshadoop3hadoop@hadoop1:/home/hadoop/.ssh使用cat authorized_keys_hadoop1 >> 
authorized_keys 命令 使用$scp authorized_keys 
hadoop@hadoop2:/home/hadoop/.ssh把密码文件分发出去

  • 1.1 安装jdk

推荐jdk1.8

  • 1.2 安装并设置protobuf

注:该程序包需要在gcc安装完毕后才能安装,否则提示无法找到gcc编译器。

  • 1.2.1 下载protobuf安装包

推荐版本2.5+ 
下载链接为: https://code.google.com/p/protobuf/downloads/list 

  • 1.2.2使用ssh工具把protobuf-2.5.0.tar.gz包上传到/home/data/software目录

1.2.3 解压安装包

 
 

$tar -zxvf protobuf-2.5.0.tar.gz

  • 1.2.4 把protobuf-2.5.0目录转移到/usr/local目录下

$sudo mv protobuf-2.5.0 /usr/local 

  • 1.2.5 进行目录运行命令

进入目录以root用户运行如下命令:

#./configure
#make
#make check
#make install

  • 1.2.6 验证是否安装成功

运行成功之后,通过如下方式来验证是否安装成功 

#protoc

2 安装hadoop

  • 2.1 上传、解压、创建目录
tar -zxvf
mkdir tmp
Mdkdir name
Mkdir data
  • 2.2 hadoop核心配置

配置路径:/home/data/app/hadoop/etc/hadoop 
Core.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed 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. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://shulaibao1:9010</value>
</property>
<property>
<name>fs.defaultFS</name>
<value>hdfs://shulaibao1:9010</value>
</property>
<property>
<name>io.file.buffer.size</name>
<value>131072</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/home/data/app/hadoop/hadoop-2.8.0/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
<property>
<name>hadoop.proxyuser.hduser.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hduser.groups</name>
<value>*</value>
</property>
</configuration>

Hdfs-site.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed 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. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>shulaibao1:9011</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/home/data/app/hadoop/hadoop-2.8.0/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/home/data/app/hadoop/hadoop-2.8.0/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
</configuration>

Mapred-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed 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. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>shulaibao1:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>shulaibao1:19888</value>
</property>
</configuration>

Yarn-site.xml

<?xml version="1.0"?>
<!--
Licensed 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. See accompanying LICENSE file.
--> <!-- Site specific YARN configuration properties --> <configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<property>
<name>yarn.resourcemanager.address</name>
<value>shulaibao1:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>shulaibao1:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>shulaibao1:8031</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>shulaibao1:8033</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>shulaibao1:8088</value>
</property>
</configuration>

Slaves 
shulaibao1 
shulaibao2

  • 2.2 hadoop-env.sh yarn-env.sh环境配置

/home/hadoop/.bash_profile增加环境变量

export JAVA_HOME=/home/data/software/jdk1.8.0_121
export HADOOP_HOME=/home/data/app/hadoop/hadoop-2.8.0
export PATH=$PATH:/home/data/app/hadoop/hadoop-2.8.0/bin

Hadoop-env.sh修改export

  • HADOOP_CONF_DIR={HADOOP_CONF_DIR:-"HADOOP_HOME/etc/hadoop”}
  • 2.3 分发到Scp -r source target -h -p2.4 验证hdfs

路径:/home/data/app/hadoop/hadoop-2.8.0/bin

  • 初始化格式化namenode

$./bin/hdfs namenode -format

  • 启动hdfs

$./start-dfs.sh

  • Jps

Master: 

Slave: 

3 安装spark

  • 3.1 下载并上传并解压
  • 3.2 基础环境配置
/etc/profile
export SPARK_HOME=/home/data/app/hadoop/spark-2.1.1-bin-hadoop2.7
export PATH=$PATH:$SPARK_HOME/bin:$SPARK_HOME/sbin
  • 3.3 spark核心配置
/home/data/app/hadoop/spark-2.1.1-bin-hadoop2.7/conf/spark-env.sh
export SPARK_MASTER_IP=shulaibao2
export SPARK_MASTER_PORT=7077
export SPARK_WORKER_CORES=1
export SPARK_WORKER_INSTANCES=1
export SPARK_WORKER_MEMORY=512M
export SPARK_LOCAL_IP=192.168.0.251
export PYTHONH vim /home/data/app/hadoop/spark-2.1.1-bin-hadoop2.7/conf/slaves
shulaibao1
shulaibao2
  • 3.4 发到其他机器

  • 3.5 启动spark并验证

/home/data/app/hadoop/spark-2.1.1-bin-hadoop2.7/sbin
./start-all.sh

Master: 
 
Slave: 

Spark webui:http://192.168.0.252:8082/ 

1 大数据实战系列-spark+hadoop集成环境搭建的更多相关文章

  1. 大数据学习系列之四 ----- Hadoop+Hive环境搭建图文详解(单机)

    引言 在大数据学习系列之一 ----- Hadoop环境搭建(单机) 成功的搭建了Hadoop的环境,在大数据学习系列之二 ----- HBase环境搭建(单机)成功搭建了HBase的环境以及相关使用 ...

  2. 大数据学习系列之二 ----- HBase环境搭建(单机)

    引言 在上一篇中搭建了Hadoop的单机环境,这一篇则搭建HBase的单机环境 环境准备 1,服务器选择 阿里云服务器:入门型(按量付费) 操作系统:linux CentOS 6.8 Cpu:1核 内 ...

  3. [大数据学习研究] 3. hadoop分布式环境搭建

    1. Java安装与环境配置 Hadoop是基于Java的,所以首先需要安装配置好java环境.从官网下载JDK,我用的是1.8版本. 在Mac下可以在终端下使用scp命令远程拷贝到虚拟机linux中 ...

  4. 大数据学习系列之七 ----- Hadoop+Spark+Zookeeper+HBase+Hive集群搭建 图文详解

    引言 在之前的大数据学习系列中,搭建了Hadoop+Spark+HBase+Hive 环境以及一些测试.其实要说的话,我开始学习大数据的时候,搭建的就是集群,并不是单机模式和伪分布式.至于为什么先写单 ...

  5. 大数据学习系列之六 ----- Hadoop+Spark环境搭建

    引言 在上一篇中 大数据学习系列之五 ----- Hive整合HBase图文详解 : http://www.panchengming.com/2017/12/18/pancm62/ 中使用Hive整合 ...

  6. 大数据学习系列之八----- Hadoop、Spark、HBase、Hive搭建环境遇到的错误以及解决方法

    前言 在搭建大数据Hadoop相关的环境时候,遇到很多了很多错误.我是个喜欢做笔记的人,这些错误基本都记载,并且将解决办法也写上了.因此写成博客,希望能够帮助那些搭建大数据环境的人解决问题. 说明: ...

  7. 《OD大数据实战》Spark入门实例

    一.环境搭建 1. 编译spark 1.3.0 1)安装apache-maven-3.0.5 2)下载并解压 spark-1.3.0.tgz 3)修改make-distribution.sh  VER ...

  8. 大数据学习(19)—— Flume环境搭建

    系统要求 Java1.8或以上 内存要足够大 硬盘足够大 Agent对源和目的要有读写权限 Flume部署 我这8G内存的电脑之前搭建Hadoop.Hive和HBase已经苟延残喘了,怀疑会卡死,硬着 ...

  9. 大数据学习(16)—— HBase环境搭建和基本操作

    部署规划 HBase全称叫Hadoop Database,它的数据存储在HDFS上.我们的实验环境依然基于上个主题Hive的配置,参考大数据学习(11)-- Hive元数据服务模式搭建. 在此基础上, ...

  10. 大数据学习系列之Hadoop、Spark学习线路(想入门大数据的童鞋,强烈推荐!)

    申明:本文出自:http://www.cnblogs.com/zlslch/p/5448857.html(该博客干货较多) 1 Java基础: 视频方面:          推荐<毕向东JAVA ...

随机推荐

  1. LeeCode数组问题:二分查找

    LeeCode 704 二分查找 题目描述: 给定一个 n 个元素有序的(升序)整型数组 nums 和一个目标值 target ,写一个函数搜索 nums 中的 target,如果目标值存在返回下标, ...

  2. linux 给lvm磁盘扩容

    目录 linux 给lvm磁盘扩容 扩容步骤 确认可用空间 创建新的物理卷 将物理卷添加到现有的卷组中 扩展逻辑卷 linux 给lvm磁盘扩容 早上到公司发现磁盘满了,挂载点是一个lvm 跟领导确认 ...

  3. 极速免费部署,国内可用 ChatGPT 网页版

    极速免费部署,国内可用 ChatGPT 网页版 我的星球微信群虽然接入了ChatGPT,但是依然有星友反馈说艾特机器人太麻烦,有些问题也不方便公开. 昨天充值api成功了,终于有底气把网页版开放给星友 ...

  4. scikit-learn 中 Boston Housing 数据集问题解决方案

    scikit-learn 中 Boston Housing 数据集问题解决方案 在部分旧教程或教材中是 sklearn,现在[2023]已经变更为 scikit-learn 作用:开源机器学习库,支持 ...

  5. GDOU-CTF-2023新生赛Pwn题解与反思

    第一次参加CTF新生赛总结与反思 因为昨天学校那边要进行天梯模拟赛,所以被拉过去了.16点30分结束,就跑回来宿舍开始写.第一题和第二题一下子getshell,不用30分钟,可能我没想那么多,对比网上 ...

  6. 图计算引擎分析--GridGraph

    作者:京东科技 李永萍 GridGraph:Large-Scale Graph Processing on a Single Machine Using 2-Level Hierarchical Pa ...

  7. Vue的项目打包为移动端(安卓手机应用)app

    现在基于vue全家桶技术体系,基本上可以开发各端的各种应用,pc端的应用,开发完成以后,直接运行打包命令 yarn build 即可打包,部署到服务器端上线即可.那么,今天我们来聊一聊,开发好的vue ...

  8. TensorFlow - 框架实现中的三种 Graph

    文章目录 TensorFlow - 框架实现中的三种 Graph 1. Graph 2. GraphDef 3. MetaGraph 4. Checkpoint 5. 总结 TensorFlow - ...

  9. [图像处理]仿射变换(Affine Transformation)

    文章目录 仿射变换(Affine Transformation) 平移变换 Translation 缩放变换(Scale) 剪切变换(Shear) 旋转变换(Rotation) 组合 仿射变换(Aff ...

  10. JavaFx 生成二维码工具类封装

    原文地址: JavaFx 生成二维码工具类封装 - Stars-One的杂货小窝 之前星之音乐下载器有需要生成二维码功能,当时用的是一个开源库来实现的,但是没过多久,发现那个库依赖太多,有个http- ...