<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. --><configuration><!-- 分布式文件系统 --><property><name>fs.default.name</name><value>hdfs://node1:8020</value></property><!-- 临时文件目录 --><property><name>hadoop.tmp.dir</name><value>/usr/local/hadoop/data/tmp</value></property><!-- 缓冲区大小,根据实际调整 --><property><name>io.file.buffer.size</name><value>4096</value></property><!-- 垃圾超时时间(分钟) --><property><name>fs.trash.interval</name><value>10080</value></property></configuration>
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. --><configuration><!-- namenode 访问地址,hadoop3.0 默认改为 9870 端口 --><property><name>dfs.namenode.http-address</name><value>node1:9870</value></property><property><name>dfs.namenode.secondary.http-address</name><value>node2:9868</value></property><!-- namenode/datanode 数据存放目录 --><property><name>dfs.namenode.name.dir</name><value>file:///usr/local/hadoop/data/namenodeData, file:///usr/local/hadoop/data/namenodeData2</value></property><property><name>dfs.datanode.data.dir</name><value>file:///usr/local/hadoop/data/datanodeData, file:///usr/local/hadoop/data/datanodeData2</value></property><!-- 日志文件存放目录 --><property><name>dfs.namenode.edits.dir</name><value>file:///usr/local/hadoop/data/nn/edits</value></property><property><name>dfs.namenode.checkpoint.dir</name><value>file:///usr/local/hadoop/data/snn/name</value></property><property><name>dfs.namenode.checkpoint.edits.dir</name><value>file:///usr/local/hadoop/data/snn/edits</value></property><!-- 文件副本数 --><property><name>dfs.replication</name><value>3</value></property><!-- 设置 hdfs 的文件权限(关闭) --><property><name>dfs.permissions</name><value>false</value><!-- 文件副本数 --><property><name>dfs.replication</name><value>3</value></property></property><!-- 文件切片大小(128M) --><property><name>dfs.blocksize</name><value>134217728</value></property></configuration>
mapred-env.sh
export JAVE_HOME=/usr/local/jdk
mapred-site.xml
<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. --><configuration><property><name>mapreduce.framework.name</name><value>yarn</value></property><property><name>yarn.app.mapreduce.am.env</name><value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value></property><property><name>mapreduce.map.env</name><value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value></property><property><name>mapreduce.reduce.env</name><value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value></property><property><name>yarn.app.mapreduce.am.resource.mb</name><value>1200</value><description>表示MRAppMaster需要的总内存大小,默认是1536</description></property><property><name>yarn.app.mapreduce.am.command-opts</name><value>-Xmx800m</value><description>表示MRAppMaster需要的堆内存大小,默认是:-Xmx1024m</description></property><property><name>yarn.app.mapreduce.am.resource.cpu-vcores</name><value>1</value><description>表示MRAppMaster需要的的虚拟cpu数量,默认是:1</description></property><property><name>mapreduce.map.memory.mb</name><value>512</value><description>表示MapTask需要的总内存大小,默认是1024</description></property><property><name>mapreduce.map.java.opts</name><value>-Xmx300m</value><description>表示MapTask需要的堆内存大小,默认是-Xmx200m</description></property><property><name>mapreduce.map.cpu.vcores</name><value>1</value><description>表示MapTask需要的虚拟cpu大小,默认是1</description></property><property><name>mapreduce.reduce.memory.mb</name><value>512</value><description>表示ReduceTask需要的总内存大小,默认是1024</description></property><property><name>mapreduce.reduce.java.opts</name><value>-Xmx300m</value><description>表示ReduceTask需要的堆内存大小,默认是-Xmx200m</description></property><property><name>mapreduce.reduce.cpu.vcores</name><value>1</value><description>表示ReduceTask需要的虚拟cpu大小,默认是1</description></property></configuration>
yarn-site.xml
<?xml version="1.0"?><!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--><configuration><!-- Site specific YARN configuration properties --><!-- 主节点位置 --><property><name>yarn.resourcemanager.hostname</name><value>node1</value></property><property><name>yarn.resourcemanager.aux-services</name><value>mapreduce_shuffle</value></property><!-- 关闭 yarn 的内存检查,准备配置 spark --><property><name>yarn.nodemanager.pmem-check-enabled</name><value>false</value></property><property><name>yarn.nodemanager.vmem-check-enabled</name><value>false</value></property><!-- 日志聚合功能 --><property><name>yarn.log-aggregation-enable</name><value>true</value></property><!-- 聚合日志在 hdfs 上的保存时间 --><property><name>yarn.log-aggregation.retain-seconds</name><value>604800</value></property><!-- 设置集群的内存分配方案 --><property><name>yarn.nodemanager.resource.memory-mb</name><value>20480</value></property><property><name>yarn.scheduler.minimum-allocation-mb</name><value>2048</value></property><property><name>yarn.nodemanager.vmem-pmem-ratio</name><value>2.1</value></property></configuration>