### 创建新文件夹
mkdir -p /root/data/tmp /root/data/logs
###
/root/data/tmp # 存放临时文件,系统重启后,不会丢失
/root/data/logs # 存放Hadoop所有的日志文件
core-site.xml
<property>
<name>hadoop.tmp.dir</name>
<value>/root/data/tmp</value>
</property>
<property>
<name>fs.defaultFS</name>
<value>hdfs://spark3:9000</value>
</property>
hadoop-env.sh
#
export JAVA_HOME=/root/app/java
export HDFS_NAMENODE_USER=root
export HDFS_DATANODE_USER=root
export HDFS_SECONDARYNAMENODE_USER=root
export YARN_RESOURCEMANAGER_USER=root
export YARN_NODEMANAGER_USER=root
# HADOOP LOG
export HADOOP_LOG_DIR=/root/data/logs
hdfs-site.xml
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>spark3:9868</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
mapred-site.xml
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
workers
#### 注释掉localhost,添加spark3
#localhost
spark3
yarn-site.xml
<property>
<name>yarn.resourcemanager.hostname</name>
<value>spark3</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.application.classpath</name>
<value>/root/app/hadoop/etc/hadoop:/root/app/hadoop/share/hadoop/common/lib/*:/root/app/hadoop/share/hadoop/common/*:/root/app/hadoop/share/hadoop/hdfs:/root/app/hadoop/share/hadoop/hdfs/lib/*:/root/app/hadoop/share/hadoop/hdfs/*:/root/app/hadoop/share/hadoop/mapreduce/*:/root/app/hadoop/share/hadoop/yarn:/root/app/hadoop/share/hadoop/yarn/lib/*:/root/app/hadoop/share/hadoop/yarn/*</value>
</property>