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. kubernetes核心实战(七)--- job、CronJob、Secret

    10.job任务 使用perl,做pi的圆周率计算 [root@k8s-master-node1 ~/yaml/test]# vim job.yaml [root@k8s-master-node1 ~ ...

  2. pandas之统计函数

    Pandas 的本质是统计学原理在计算机领域的一种应用实现,通过编程的方式达到分析.描述数据的目的.而统计函数则是统计学中用于计算和分析数据的一种工具.在数据分析的过程中,使用统计函数有助于我们理解和 ...

  3. 2.JWT实现单点登录的概念

    1.总结: 昨天主要是了解了JWT的作用.构成以及RSA的作用和构成,再就是分布式认证的流程和集中式的差别 JWT的作用:JWT用于生成和校验token JWT的构成:头部.载荷以及签名 头部:设置规 ...

  4. spring事务里面开启线程插入,报错了是否会回滚?

    1.前言 一道非常有意思的面试题目.大概是这样子的,如果在一个事务中,开启线程进行插入更新等操作,如果报错了,事务是否会进行回滚 2.代码 示例1 @RequestMapping("/tes ...

  5. 尝试CentOS8---部署集群(生产环境7.9为好)

    一.LVS集群简介 什么是集群 通过网络将很多服务器集中起来,提供同一种服务,在客户端看来就像是只有一个服务器 二.LVS-NAT集群 1.环境准备 启动3台虚拟机,禁用selinux和firewal ...

  6. 这可能是最全面的MySQL面试八股文了

    什么是MySQL MySQL是一个关系型数据库,它采用表的形式来存储数据.你可以理解成是Excel表格,既然是表的形式存储数据,就有表结构(行和列).行代表每一行数据,列代表该行中的每个值.列上的值是 ...

  7. 访问nginx报错502日志:failed (13: Permission denied) while connecting to upstream

    1.错误问题 nginx启动成功,但是访问nginx报错502.检查后台项目,使用IP+端口可以正常访问项目的,这说明项目启动成功了.那就是nginx的问题.检查了nginx.conf文件发现配置的反 ...

  8. RTSP Server(LIVE555)源码分析(五)-PLAY信令

    主要分析RTSPServer::RTSPClientSession针对客户端PLAY事件处理 一. PLAY信令,handleCmd_withinSession源码解析 1)步骤1.03,当RTSP客 ...

  9. RK3568用户自定义开机画面功能

    RK方案中的开机画面处画逻辑 在RK的方案中,如RK1109,RK1126,RK3568这些嵌入式LINUX方案在开机画面的处理逻辑都是一致的. 用户的uboot,kernel开机画面都是同dts,k ...

  10. python 高级函数补充

    补充几个高级函数 zip 把两个可迭代内容生成一个可迭代的tuple元素类型组成的内容 # zip 案例 l1 = [ 1,2,3,4,5] l2 = [11,22,33,44,55] z = zip ...