一、安装Java
1. 下载Java
进入下载页面Java Archive Downloads - Java SE 8
Java SE Development Kit 8u191中
选择适合操作系统的下载文件
在安装好的路径下,将Java目录复制到C:\根目录下,形成C:\Java\jdk1.8.0_191目录结构
2. 设置环境变量
注意:要保证jdk所在的路径中不能包含空格,比如Program Files中间是有空格的,建议参照下图中的路径
二、安装Hadoop
1. 下载hadoop-3.3.0
进入下载页面
https://archive.apache.org/dist/hadoop/common/hadoop-3.3.0/
选择hadoop-3.3.0.tar.gz下载
https://archive.apache.org/dist/hadoop/common/hadoop-3.3.0/hadoop-3.3.0.tar.gz
解压到C:\hadoop-3.3.0目录,形成C:\hadoop-3.3.0\bin这种目录层次
2. 下载winutils替换hadoop-3.3.0\bin目录
下载winutils
https://github.com/s911415/apache-hadoop-3.1.0-winutils
将其中bin目录替换到C:\hadoop-3.3.0\下的bin目录
3. 设置环境变量
4. 修改配置
C:\hadoop-3.3.0\etc\hadoop目录下有4个配置文件
C:\hadoop-3.3.0\etc\hadoop\core-site.xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9820</value>
</property>
</configuration>
C:\hadoop-3.3.0\etc\hadoop\hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:///C:/hadoop-3.3.0/data/dfs/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///C:/hadoop-3.3.0/data/dfs/datanode</value>
</property>
</configuration>
C:\hadoop-3.3.0\etc\hadoop\mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
<description>MapReduce framework name</description>
</property>
</configuration>
C:\hadoop-3.3.0\etc\hadoop\yarn-site.xml
<configuration>
<!-- Site specific YARN configuration properties -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
<description>Yarn Node Manager Aux Service</description>
</property>
</configuration>
5. 格式化目录
创建数据目录
C:\hadoop-3.3.0\data\dfs\namenode
C:\hadoop-3.3.0\data\dfs\datanode
cd C:\hadoop-3.3.0\bin
hdfs namenode -format
注意:-format中开头的短横容易写成全角下的短横,这样会导致错误,一定要用半角短横
选择Y
6. 验证服务
C:\hadoop-3.3.0\sbin> jps
17504 NameNode
17584 Jps
20944 NodeManager
3852 DataNode
4572 ResourceManager
PS C:\hadoop-3.3.0\sbin>
7. 启动
进入C:\hadoop-3.3.0\sbin
执行start-dfs.cmd文件
cd C:\hadoop-3.3.0\sbin
start-dfs.cmd
执行start-yarn.cmd文件
cd C:\hadoop-3.3.0\sbin
start-yarn.cmd
可能问题:
如果出现报错:
java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/server/timelineservice/collector/TimelineColl
可以复制
C:\hadoop-3.3.0\share\hadoop\yarn\timelineservice\hadoop-yarn-server-timelineservice-3.3.0.jar
到
C:\hadoop-3.3.0\share\hadoop\yarn
8. Hadoop的WebUI工具
Name node web page: http://localhost:9870/dfshealth.html
Data node web page: http://localhost:9864/datanode.html
Yarn web page: http://localhost:8088/cluster
三、参考文章
版权归原作者 xiliuhu 所有, 如有侵权,请联系我们删除。