windows下运行hadoop2.7.2

1.下载hadoop-2.7.2.tar.gz

2.解压到D:\hadoop\

3.配置HADOOP_HOME环境变量

4.将%HADOOP_HOME%\bin目录添加到path环境变量中

5.配置JAVA_HOME环境变量,注意路径不要带空格

6.下载hadoop-common-bin工具包(注意和hadoop的版本要对应,否则执行hdfs命令时可能会报错),将bin目录下的winutils.exe、hadoop.dll等全部拷到HADOOP_HOME\bin目录下并替换掉同名文件

7.配置hadoop配置文件(hadoop/etc/hadoop/目录下)

a. core-site.xml

<configuration>
  <property>
<name>hadoop.tmp.dir</name>
<value>file:/hadoop/hadoop272/tmp</value>
    <description>Abase for other temporary directories.</description>
</property>
  <property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>

 

b. hdfs-site.xml

<configuration>
  <property>
    <name>dfs.permissions</name>
    <value>false</value>
  </property>
  <property>
    <name>dfs.replication</name>
    <value>1</value>
  </property>
  <property>
    <name>dfs.namenode.name.dir</name>
    <value>file:/hadoop/hadoop272/data/dfs/namenode</value>
  </property>
  <property>
    <name>dfs.datanode.data.dir</name>
    <value>file:/hadoop/hadoop272/data/dfs/datanode</value>
  </property> 
</configuration>

 

c. maprd-site.xml

<configuration>
  <property>
    <name>mapreduce.framework.name</name>
    <value>yarn</value>
  </property>
</configuration>

 

d. 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>

8.格式化hdfs: 在bin目录下执行: hdfs namenode –format

9.启动hadoop: 在sbin目录下执行: start-all.cmd

10. 查看进程是否启动成功:jps

  

 

11.访问:

  hdfs: http://localhost:50070

  yarn: http://localhost:8088/

12.创建目录: 在bin目录下执行hdfs dfs –mkdir /user (或: hadoop fs –mkdir /user)

13.查看目录: 在bin目录下执行:hdfs dfs -ls /user

14.创建文件: 在bin目录下执行: hdfs dfs –put test.txt /user/

15.查看文件:在bin目录下执行:hdfs dfs –cat /user/test.txt

posted @ 2016-12-24 22:29  一人浅醉-  阅读(721)  评论(0编辑  收藏  举报