haoop搭建记录

hadoop集群搭建

1.配置jdk环境

##jdk1.8
export JAVA_HOME=/mydata/jdk1.8.0_151
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

2.解压tar包

3.配置hadoop环境

#hadoop
export HADOOP_HOME=/mydata/hadoop-2.7.4
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

4.修改主机名,配置host解析文件

hostnamectl set-hostname hadoop1

172.16.233.173 hadoop3
172.16.233.174 hadoop1
172.16.233.175 hadoop2

5.配置免密登录

ssh-copy-id -i .ssh/id_rsa.pub  172.16.233.174

ssh-copy-id -i .ssh/id_rsa.pub  hadoop1

6.配置hadoop文件

hdfs-site.xml

<!-- 设置secondarynamenode的http通讯地址 -->
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>hadoop1:50090</value>
</property>

<!-- 设置namenode存放的路径 -->
<property>
<name>dfs.namenode.name.dir</name>
<value>/mydata/hadoop-2.7.4/hdfs/name</value>
</property>

<!-- 设置hdfs副本数量 -->
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<!-- 设置datanode存放的路径 -->
<property>
<name>dfs.datanode.data.dir</name>
<value>/mydata/hadoop-2.7.4/hdfs/data</value>
</property>

 

core-site.xml 

<property>
<name>fs.defaultFS</name>
<value>hdfs://hadoop1:9000</value>
</property>
<!-- 指定hadoop运行时产生文件的存储目录 -->
<property>
<name>hadoop.tmp.dir</name>
<value>/mydata/hadoop-2.7.4/hdfs/tmp</value>
</property>

 

yarn-site.xml

<property>
<name>yarn.resourcemanager.address</name>
<value>hadoop1:18040</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>hadoop1:18030</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>hadoop1:8088</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>hadoop1:18025</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>hadoop1:18141</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<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.nodemanager.resource.cpu-vcores</name>
<value>1</value>
</property>
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>1600</value>
</property>

 

mapred-site.xml

 <property>
  <name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<!-- 历史服务器端地址 -->
<property>
<name>mapreduce.jobhistory.address</name>
<value>hadoop1:10020</value>
</property>
<!-- 历史服务器web端地址 -->
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>hadoop1:19888</value>
</property>

启动历史服务器:   mr-jobhistory-daemon.sh start historyserver

7.将hadoop文件夹拷贝到其他服务器

8.初始化主节点的namenode

hdfs  namenode  -format

9.启动集群   start-all.sh

10.页面观察hadoop集群运行情况

8088端口

 

posted @ 2021-01-04 09:38  天宇星空  阅读(68)  评论(0编辑  收藏  举报