很多人喜欢用Windows本地开发Hadoop程序,这里是一个在Windows下配置Hadoop的教程。

首先去官网下载hadoop,这里需要下载一个工具winutils,这个工具是编译hadoop用的,下载完之后解压hadoop文件,然后把winutils.exe放到hadoop文件的bin目录下面

然后在hadoop/etc/hadoop下修改以下文件:

core-site.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000/</value>
</property>
<property>
<name>io.native.lib.available</name>
<value>false</value>
</property>
<property>
<name>hadoop.native.lib</name>
<value>false</value>
</property>
<property>
<name>io.compression.codecs</name>
<value>org.apache.hadoop.io.compress.GzipCodec,
org.apache.hadoop.io.compress.DefaultCodec,
com.hadoop.compression.lzo.LzoCodec,
com.hadoop.compression.lzo.LzopCodec,
org.apache.hadoop.io.compress.BZip2Codec,
org.apache.hadoop.io.compress.SnappyCodec
</value>
</property>
<property>
<name>io.compression.codec.lzo.class</name>
<value>com.hadoop.compression.lzo.LzoCodec</value>
</property> </configuration>

hdfs-site.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:///D:/Hadoop/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///D:/Hadoop/datanode</value>
</property>
</configuration>

mapred-site.xml:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapred.compress.map.output</name>
<value>true</value>
</property>
<property>
<name>mapred.map.output.compression.codec</name>
<value>com.hadoop.compression.lzo.LzoCodec</value>
</property>
<property>
<name>mapred.child.env</name>
<value>LD_LIBRARY_PATH=</value>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapred.compress.map.output</name>
<value>true</value>
</property>
<property>
<name>mapred.map.output.compression.codec</name>
<value>com.hadoop.compression.lzo.LzoCodec</value>
</property>
<property>
<name>mapred.child.env</name>
<value>LD_LIBRARY_PATH=D:\hadoop-2.7.3-win64\lib</value>
</property>
</configuration>

然后cmd到hadoop的bin目录下执行:

hdfs namenode -format

然后在sbin目录下执行:

start-all.cmd

然后浏览器打开http://localhost:8088:

执行hadoop命令:hadoop fs -ls /

空的,新建一个文件夹:hadoop fs -mkdir /data

然后查看:hadoop fs -ls /

这样就hadoop的本地伪分布式环境就配置好了。

Windows配置本地Hadoop运行环境的更多相关文章

  1. Hadoop运行环境搭建

    Hadoop运行环境搭建 更改为阿里的Centos7的yum源 #下载wget yum -y install wget #echo 下载阿里云的yum源配置  Centos-7.repo wget - ...

  2. Mac配置本地hadoop

    Mac配置本地hadoop 这学期要学习大数据,于是在自己的mac上配置了hadoop环境.由于Mac是OSX系统,所以配置方法跟Linux类似 一.下载hadoop 从官网下载压缩包. $ll to ...

  3. 配置perl-cgi的运行环境,由于Active Perl安装在d:\perl

    Apache 1.3.22 for Win32+PHP 4.0.6+Active Perl 5.006001+Zend Optimizer v1.1.0+mod_gzip 1.3.19.1a+MySQ ...

  4. macOS 使用Miniconda配置本地数据运算环境

    目前,做数据分析工作,基本人手Numpy,pandas,scikit-learn.而这些计算程序包都是基于python平台的,所以搞数据的都得先装个python环境...(当然,你用R或Julia请忽 ...

  5. Windows上搭建Flume运行环境

    1.如果没有安装过Java环境,则需首先安装JDK. 可参考<Windows上搭建Kafka运行环境>中的搭建环境安装JDK部分 2.官方下载Flume(当前为apache-flume-1 ...

  6. (转)Windows上搭建Kafka运行环境

    转自:<Windows上搭建Kafka运行环境> 完整解决方案请参考: Setting Up and Running Apache Kafka on Windows OS   在环境搭建过 ...

  7. [转]Windows上搭建Kafka运行环境

    [转]http://www.cnblogs.com/alvingofast/p/kafka_deployment_on_windows.html Windows上搭建Kafka运行环境   完整解决方 ...

  8. vsCode怎么为一个前端项目配置ts的运行环境

    vsCode为一个前端项目配置ts的运行环境,ts文件保存的时候自动编译成js文件: 假设此前端项目名称为Web:文件结构如图 1. 在根目录中新建一个“.vscode”文件夹,里面建一个“tasks ...

  9. wampserver - windows服务器下php运行环境配置

    之前一直在通过windows server IIS跑php程序,直到后来,发现了她 “wampserver", 一个法国的windows+apache+php+mysql部署包. 感觉挺好用 ...

随机推荐

  1. 题解【UVA839】天平 Not so Mobile

    Description Input Output Examples Input 1 0 2 0 4 0 3 0 1 1 1 1 1 2 4 4 2 1 6 3 2 Output YES Transla ...

  2. 【14】 DFS 机器人活动范围 (static插曲)

    题目 地上有一个m行n列的方格,从坐标 [0,0] 到坐标 [m-1,n-1] .一个机器人从坐标 [0, 0] 的格子开始移动,它每次可以向左.右.上.下移动一格(不能移动到方格外),也不能进入行坐 ...

  3. LED Decorative Light Manufacturer - Led Wall Lamp Performance Characteristics

    LED Decorative Light Manufacturer    introduction: LED wall lamp is a light-emitting diode as a ligh ...

  4. 转载:EQ--biquad filter

    http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt https://arachnoid.com/BiQuadDesigner/index.html ...

  5. C#中数据类型char*,const char*和string的三者转换

    C#中数据类型char*,const char*和string的三者转换: . const char* 和string 转换 () const char*转换为 string,直接赋值即可. EX: ...

  6. auto_prt的VS版本源码剖析

    通过对VC版本的auto_ptr的源代码得知VC版本还有一点小缺陷,又对VS版本的auto_ptr做了一些剖析,具体代码和注释如下: //假设全局pa2都是用pa1来构造 //如:pa2(pa1).p ...

  7. C语言随笔4:指针数组、数组指针

    数组: 1:数组名为地址,表达方法: Int A[10]; A;//数组名表示首地址 &A;//数组名加取地址符,仍然表示首地址 &A[0];//第0个元素的地址,即首地址 数组名是指 ...

  8. Permission denied 解决办法

    Permission denied 解决的办法: $ sudo chmod -R 777 某一目录 其中-R 是指级联应用到目录里的所有子目录和文件777 是所有用户都拥有最高权限

  9. Tarjan-SCC-NOIP2015message

    This article is made by Jason-Cow.Welcome to reprint.But please post the writer's address. http://ww ...

  10. Bugku-CTF之细心 (想办法变成admin)

    Day30     细心