很多人喜欢用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. Mysql使用事务

    DECLARE t_error INTEGER DEFAULT 0; DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET t_error=1; START TR ...

  2. pycharm连接mysql5.7

    由于加密方式改变 需要在url后增加 ?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC

  3. vue的$on,$emit

    使用 $on(eventName) 监听事件使用 $emit(eventName) 触发事件 Api 中的解释: vm.$emit( event, […args] ) 参数: {string} eve ...

  4. Solr与对应Jdk版本的关系

    Solr各版本下载地址:http://archive.apache.org/dist/lucene/solr/ 下载的包里面的CHANGES.txt 有当前版本需要的说明.

  5. 【 js 上传文件】

    上传文件 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> ...

  6. sublime添加自己的编译环境_添加一个.app或者.exe文件执行脚本

    如何添加一个.app或者.exe文件执行脚本 看了很多简书和博客,还是搞不好,最后参考官方文档搞定了: http://www.sublimetext.com/docs/3/build_systems. ...

  7. 免费天气API,天气JSON API,不限次数获取十五天的天气预报

    紧急情况说明: 禁用IP列表: 39.104.69.*(原因39.104.69.6 在2018年10月的 17~20日 排行为top 1,每天几十万次.) 47.98.211.* (原因47.98.2 ...

  8. 【转载】Hadoop面试(1)

    转自:http://www.cnblogs.com/xiaolong1032/p/4504992.html 列举出hadoop常用的一些InputFormat InputFormat是用来对我们的输入 ...

  9. eclipse 添加主題

    在使用Eclipse过程中可能想更换下界面主题,此处介绍的是一款主题插件 Eclipse Color Theme 打开Eclipse,Help --> Eclipse Marketplace 在 ...

  10. AcWing 871. 约数之和

    #include <iostream> #include <algorithm> #include <unordered_map> #include <vec ...