第一步:修改core-site.xml,配置如下内容:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
<final>true</final>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
第二步:修改hdfs-site.xml文件,配置如下内容:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.name.dir</name>
<value>/cygdrive/d/Hadoop/working/name</value>
<final>true</final>
</property>
<property>
<name>dfs.data.dir</name>
<value>/cygdrive/d/hadoop/working/data</value>
<final>true</final>
</property>
<property>
<name>fs.checkpoint.dir</name>
<value>/cygdrive/d/hadoop/working/checkpoint</value>
<final>true</final>
</property>
</configuration>
第三步:修改mapred-site.xml配置如下内容:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>hdfs://localhost:9001</value>
<final>true</final>
</property>
<property>
<name>mapred.local.dir</name>
<value>/cygdrive/d/hadoop/working/dir1,/cygdrive/d/hadoop/working/dir2</value>
<final>true</final>
</property>
<property>
<name>mapred.system.dir</name>
<value>/cygdrive/d/hadoop/working/system</value>
<final>true</final>
</property>
</configuration>
第四步,进入cygwin客户端,执行
$ cd /cygdrive/d/hadoop 【其中/d/hadoop 为hadoop安装目录,即d:\hadoop,linux表示路径和windows不同】
$ bin/hadoop namenode –format 【格式化namenode】
第五步,修改工作目录权限
$ bin/hadoop dfs chmod 777 /cygdrive/d/hadoop/working 【/cygdrive/d/hadoop/working 为工作目录,默认是tmp】
第六步,启动hadoop
$ bin/start-all.sh
$ ps –ef
通过ps查看进程,能看到5个java进程,即成功。