目录
一、环境准备
1、hadoop3.0.0下载
下载地址:Index of /dist/hadoop/core/hadoop-3.0.0
下载文件:hadoop-3.0.0.tar.gz
2、winutils工具下载
下载地址:GitHub - steveloughran/winutils: Windows binaries for Hadoop versions (built from the git commit ID used for the ASF relase)
下载文件:hadoop-3.0.0/bin
二、配置环境变量
1、解压安装包到:D:\Hadoop\HDFS\hadoop-3.0.0
2、将hadoop-3.0.0/bin文件复制一份,改名为hadoop-3.0.0/bin.template
3、将下载的 hadoop-3.0.0/bin 文件复制到 D:\Hadoop\HDFS\hadoop-3.0.0目录下
4、添加HADOOP_HOME环境变量
变量名:HADOOP_HOME
变量值:D:\Hadoop\HDFS\hadoop-3.0.0
5、系统变量path中添加HADOOP_HOME下的bin和sbin目录
%HADOOP_HOME%\bin
%HADOOP_HOME%\sbin
三、配置Hadoop
hadoop-env.cmd
@set JAVA_HOME=%JAVA_HOME%
set JAVA_HOME=C:\PROGRA~1\Java\jdk1.8
core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/G:/hadoop/data/dfs/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/G:/hadoop/data/dfs/datanode</value>
</property>
<property>
<name>fs.checkpoint.dir</name>
<value>/G:/hadoop/data/dfs/snn</value>
</property>
<property>
<name>fs.checkpoint.edits.dir</name>
<value>/G:/hadoop/data/dfs/snn</value>
</property>
</configuration>
yarn-site.xml
<configuration>
<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>
</configuration>
mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
四、初始化Hadoop
格式化NameNode
hdfs namenode -format
启动Hadoop服务
start-all
启动之后弹出四个窗口,如果窗口没有自动关闭或者自动停止则初始化成功
五、访问Hadoop
yarn:http://127.0.0.1:8088/cluster
hdfs:http://localhost:9870/explorer.html#/
六、注意事项
1、JAVA_HOME设置,PROGRA~1 代表的是 Program Files 目录
set JAVA_HOME=C:\PROGRA~1\Java\jdk1.8
2、这里的安装路径是在 D:\Hadoop\HDFS\hadoop-3.0.0
3、这里配置的HDFS的本地数据存储目录是在 G:\hadoop\data\dfs