[root@mini01 profile.d]# pwd
/etc/profile.d
[root@mini01 profile.d]# vim hadoop.sh
export HADOOP_HOME="/app/hadoop"
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
[root@mini01 profile.d]# source /etc/profile # 生效
5.2. core-site.xml
[yun@mini01 hadoop]$ pwd
/app/hadoop/etc/hadoop
[yun@mini01 hadoop]$ vim core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
……………………
<!-- Put site-specific property overrides in this file. -->
<configuration>
<!-- 指定HADOOP所使用的文件系统schema(URI),HDFS的老大(NameNode)的地址 -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://mini01:9000</value> <!-- mini01 是hostname信息 -->
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/app/hadoop/tmp</value>
</property>
<!-- 启用垃圾箱功能,单位分钟 -->
<property>
<name>fs.trash.interval </name>
<value>1440</value>
</property>
</configuration>
5.3. hdfs-site.xml
[yun@mini01 hadoop]$ pwd
/app/hadoop/etc/hadoop
[yun@mini01 hadoop]$ vim hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
………………
<!-- Put site-specific property overrides in this file. -->
<configuration>
<!-- 指定HDFS副本的数量 -->
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
<property>
<!-- 两个name标签都可以。周期性的合并fsimage和edits log文件并且使edits log保持在一定范围内。最好和namenode不在一台机器,因为所需内存和namenode一样 -->
<!-- <name>dfs.secondary.http.address</name> -->
<name>dfs.namenode.secondary.http-address</name>
<value>mini01:50090</value>
</property>
<!-- dfs namenode 的目录,可以有多个目录,然后每个目录挂不同的磁盘,每个目录下的文件信息是一样的,相当于备份 -->
<!-- 如有需要,放开注释即可
<property>
<name>dfs.namenode.name.dir</name>
<value> file://${hadoop.tmp.dir}/dfs/name,file://${hadoop.tmp.dir}/dfs/name1,file://${hadoop.tmp.dir}/dfs/name2</value>
</property>
-->
<!-- 也可以配置dfs.datanode.data.dir 配置为多个目录,相当于扩容 -->
</configuration>
5.4. mapred-site.xml
[yun@mini01 hadoop]$ pwd
/app/hadoop/etc/hadoop
[yun@mini01 hadoop]$ mv mapred-site.xml.template mapred-site.xml
[yun@mini01 hadoop]$ vim mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
………………
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
5.5. yarn-site.xml
[yun@mini01 hadoop]$ pwd
/app/hadoop/etc/hadoop
[yun@mini01 hadoop]$ vim yarn-site.xml
<?xml version="1.0"?>
……………………
<configuration>
<!-- Site specific YARN configuration properties -->
<!-- 指定YARN的老大(ResourceManager)的地址 -->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>mini02</value> <!-- 根据规划 mini02 为ResourceManager -->
</property>
<!-- reducer获取数据的方式 -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
5.6. slaves