hadoop集群搭建 修改配置文件(三台主机都要配置)
master 主机配置
1)hadoop-env.sh
vimhadoop-env.sh
2)core-site.xml
vim core-site.xml
<configuration>
<!-- 指定HDFS老大(namenode)的通信地址 -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://backup01:9000</value>
</property>
<property>
<name>io.file.buffer.size</name>
<value>131072</value>
</property>
<!-- 指定hadoop运行时产生文件的存储路径 -->
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/hadoop-3.1.2/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>
3)hdfs-site.xml
vim hdfs-site.xml
<configuration>
<!--
<property>
<name>dfs.namenode.http-address</name>
<value>backup01:9870</value>
</property>
-->
<!-- 设置secondarynamenode的http通讯地址 -->
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>backup01:9001</value>
</property>
<!-- 设置namenode存放的路径 -->
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/usr/local/hadoop/hadoop-3.1.2/dfs/name</value>
</property>
<!-- 设置datanode存放的路径 -->
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/usr/local/hadoop/hadoop-3.1.2/dfs/data</value>
</property>
<!-- 设置hdfs副本数量 -->
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
</configuration>
4)mapred-site.xml
vim mapred-site.xml
5)yarn-site.xml
6)workers (slaves节点配置)
7)start-dfs.sh 和 stop-dfs.sh
cd /usr/local/hadoop/hadoop-3.1.2/sbin
vim start-dfs.sh
vimstop-dfs.sh
8)start-yarn.sh 和 stop-yarn.sh
vimstart-yarn.sh
vimstop-yarn.sh