Hadoop2.7.3+Spark2.1.0完全分布式集群搭建过程(2)

<configuration> <property> <name>dfs.namenode.secondary.http-address</name> <value>master:50090</value> </property> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/opt/hadoop-2.7.3/hdfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/opt/hadoop-2.7.3/hdfs/data</value> </property> </configuration>

(6)$HADOOP_HOME/etc/hadoop/mapred-site.xml

复制template,生成xml:

cp mapred-site.xml.template mapred-site.xml

内容:

<configuration>
<property>
    <name>mapreduce.framework.name</name>
    <value>yarn</value>
  </property>
  <property>
          <name>mapreduce.jobhistory.address</name>
          <value>master:10020</value>
  </property>
  <property>
          <name>mapreduce.jobhistory.address</name>
          <value>master:19888</value>
  </property>
</configuration>

(7)$HADOOP_HOME/etc/hadoop/yarn-site.xml

<!-- Site specific YARN configuration properties --> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.resourcemanager.address</name> <value>master:8032</value> </property> <property> <name>yarn.resourcemanager.scheduler.address</name> <value>master:8030</value> </property> <property> <name>yarn.resourcemanager.resource-tracker.address</name> <value>master:8031</value> </property> <property> <name>yarn.resourcemanager.admin.address</name> <value>master:8033</value> </property> <property> <name>yarn.resourcemanager.webapp.address</name> <value>master:8088</value> </property>

至此master节点的hadoop搭建完毕

再启动之前我们需要

格式化一下namenode

hadoop namenode -format

WorkerN节点: (1)复制master节点的hadoop文件夹到worker上:

scp -r /opt/hadoop-2.7.3 root@wokerN:/opt #注意这里的N要改为1或者2

(2)修改/etc/profile:

过程如master一样

五、Spark2.1.0完全分布式环境搭建: MASTER节点: 1.下载文件:

wget -O "spark-2.1.0-bin-hadoop2.7.tgz" "http://d3kbcqa49mib13.cloudfront.net/spark-2.1.0-bin-hadoop2.7.tgz"

2.解压并移动至相应的文件夹;

tar -xvf spark-2.1.0-bin-hadoop2.7.tgz mv spark-2.1.0-bin-hadoop2.7 /opt

3.修改相应的配置文件: (1)/etc/profie

#Spark enviroment export SPARK_HOME=/opt/spark-2.1.0-bin-hadoop2.7/ export PATH="$SPARK_HOME/bin:$PATH"

(2)$SPARK_HOME/conf/spark-env.sh

cp spark-env.sh.template spark-env.sh

#配置内容如下:
export SCALA_HOME=/usr/share/scala export JAVA_HOME=/usr/java/jdk1.8.0_112/ export SPARK_MASTER_IP=master export SPARK_WORKER_MEMORY=1g export HADOOP_CONF_DIR=/opt/hadoop-2.7.3/etc/hadoop

(3)$SPARK_HOME/conf/slaves

cp slaves.template slaves

配置内容如下

master worker1 worker2

WorkerN节点:

将配置好的spark文件复制到workerN节点

scp spark-2.1.0-bin-hadoop2.7 root@workerN:/opt

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/1849f8e188db475fd6ae6237465b590a.html