配置hadoop-env.sh
1、编辑hadoop-env.sh
vim /hadoop/hadoop-2.6.0/etc/hadoop/hadoop-env.sh
2、修改JAVA_HOME路径
export JAVA_HOME=/hadoop/jdk1.8.0_221
配置yarn-env.sh
1、编辑yarn-env.sh
vi /hadoop/hadoop-2.6.0/etc/hadoop/yarn-env.sh
2、修改JAVA_HOME路径
export JAVA_HOME=/hadoop/jdk1.8.0_221
配置核心组件core-site.xml
1、创建目录,用于存放数据落地到本地服务器的磁盘位置
mkdir /hadoop/hadoopdata
2、编辑core-site.xml文件
vi /hadoop/hadoop-2.6.0/etc/hadoop/core-site.xml
3、配置文件中添加内容
<configuration>
<!– 指定HDFS中NameNode的地址–>
<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property>
<!– 指定hadoop运行时产生文件的存储目录–>
<property>
<name>hadoop.tmp.dir</name>
<value>/hadoop/hadoopdata</value>
<description>Abasefor other temporary directories.</description>
</property>
</configuration>
配置文件系统hdfs-site.xml
vi /hadoop/hadoop-2.6.0/etc/hadoop/hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
</configuration>
配置yarn-site.xml
vi /home/zjw/hadoop-2.6.0/etc/hadoop/yarn-site.xml
<configuration>
<!– Site specific YARN configuration properties –>
<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.resourcemanager.address</name><value>master:18040</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>master:18030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>master:18025</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>master:18141</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>master:18088</value>
</property>
</configuration>
配置计算框架mapred-site.xml
1)创建mapred-site.xml文件
cp /hadoop/hadoop-2.6.0/etc/hadoop/mapred-site.xml.template /hadoop/hadoop-2.6.0/etc/hadoop/mapred-site.xml
2)编辑配置mapred-site.xml
vi /hadoop/hadoop-2.6.0/etc/hadoop/mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
配置slave
vi /hadoop/hadoop-2.6.0/etc/hadoop/slaves
文件中添加以下内容:
slave1
slave2
配置hadoop启动环境变量
1)编辑配置文件
vi /etc/profile
2)底部添加内容:
export HADOOP_HOME=/home/zjw/hadoop-2.6.0
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS=-Djava.library.path=$HADOOP_HOME/lib
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
3)执行以下名称,环境变量才能生效
source /etc/profile