1、安装

1.1、下载hadoop-2.5.1.tar.gz

1.2、解压至安装目录

tar -zxv -f hadoop-2.5.1.tar.gz  -C ../soft/

1.3、配置hadoop相关配置文件

vim .bashrc
##添加JAVA配置
export JAVA_HOME=/usr/xuelu/java
export PATH=$PATH:$JAVA_HOME/bin

vim .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi # User specific environment and startup programs PATH=$PATH:$HOME/bin #设置hadoop的环境变量
export HADOOP_HOME=/home/xuelul/soft/hadoop251
#设置maven的环境变量
export MAVEN_HOME=/usr/xuelul/maven
export ZOOKEEPER_HOME=/home/xuelu/soft/zoo346
PATH=$PATH:$HADOOP_HOME/bin:$MAVEN_HOME/bin:$ZOOKEEPER_HOME/bin
export PATH

source .bash_profile,使上述修改生效

修改hadoop自带的配置文件:

etc/hadoop/core-site.xml:

<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>

etc/hadoop/hdfs-site.xml:

<configuration>
<property>
<name>dfs.replication</name>
<value></value>
</property>
</configuration>

Setup passphraseless ssh

Now check that you can ssh to the localhost without a passphrase:

  $ ssh localhost

If you cannot ssh to localhost without a passphrase, execute the following commands:

  $ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys 数据准备:
$ mkdir input
$ cp etc/hadoop/*.xml input
#1、格式化文件系统:

   $ bin/hdfs namenode -format

#2、开启 NameNode daemon and DataNode daemon:

      $ sbin/start-dfs.sh

#3、The hadoop daemon log output is written to the $HADOOP_LOG_DIR directory (defaults to $HADOOP_HOME/logs).
Browse the web interface for the NameNode; by default it is available at:
NameNode - http://localhost:50070/
#4、Make the HDFS directories required to execute MapReduce jobs: $ bin/hdfs dfs -mkdir /user
$ bin/hdfs dfs -mkdir /user/<username> #5、Copy the input files into the distributed filesystem: $ bin/hdfs dfs -put etc/hadoop input #6、Run some of the examples provided: $ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5..jar grep input output 'dfs[a-z.]+' #7、Examine the output files: Copy the output files from the distributed filesystem to the local filesystem and examine them: $ bin/hdfs dfs -get output output
$ cat output/* or View the output files on the distributed filesystem: $ bin/hdfs dfs -cat output/* #8、When you're done, stop the daemons with: $ sbin/stop-dfs.sh

YARN on Single Node

You can run a MapReduce job on YARN in a pseudo-distributed mode by setting a few parameters and running ResourceManager daemon and NodeManager daemon in addition.

The following instructions assume that 1. ~ 4. steps of the above instructions are already executed.

  1. Configure parameters as follows:

    etc/hadoop/mapred-site.xml:

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

    etc/hadoop/yarn-site.xml:

    <configuration>
    <property>
    <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
    </property>
    </configuration>
  2. Start ResourceManager daemon and NodeManager daemon:
      $ sbin/start-yarn.sh
  3. Browse the web interface for the ResourceManager; by default it is available at:
    • ResourceManager - http://localhost:8088/
  4. Run a MapReduce job.
  5. When you're done, stop the daemons with:
      $ sbin/stop-yarn.sh

Hadoop安装和使用的更多相关文章

  1. linux hadoop安装

    linux hadoop安装 本文介绍如何在Linux下安装伪分布式的hadoop开发环境. 在一开始想利用cgywin在 windows下在哪, 但是一直卡在ssh的安装上.所以最后换位虚拟机+ub ...

  2. 转载:Hadoop安装教程_单机/伪分布式配置_Hadoop2.6.0/Ubuntu14.04

    原文 http://www.powerxing.com/install-hadoop/ 当开始着手实践 Hadoop 时,安装 Hadoop 往往会成为新手的一道门槛.尽管安装其实很简单,书上有写到, ...

  3. hadoop安装遇到的各种异常及解决办法

    hadoop安装遇到的各种异常及解决办法 异常一: 2014-03-13 11:10:23,665 INFO org.apache.hadoop.ipc.Client: Retrying connec ...

  4. hadoop安装实战(mac实操)

    集群环境配置参考(http://blog.csdn.net/zcf1002797280/article/details/49500027) 参考:http://www.cnblogs.com/liul ...

  5. hadoop安装计

    hadoop安装计 大体上按这个做就好了 http://blog.csdn.net/hitwengqi/article/details/8008203 需要修改hadoop-env.sh export ...

  6. [Hadoop入门] - 2 ubuntu安装与配置 hadoop安装与配置

    ubuntu安装(这里我就不一一捉图了,只引用一个网址, 相信大家能力) ubuntu安装参考教程:  http://jingyan.baidu.com/article/14bd256e0ca52eb ...

  7. Hadoop安装(Ubuntu Kylin 14.04)

    安装环境:ubuntu kylin 14.04   haoop-1.2.1   hadoop下载地址:http://apache.mesi.com.ar/hadoop/common/hadoop-1. ...

  8. hadoop安装配置——伪分布模式

    1. 安装 这里以安装hadoop-0.20.2为例 先安装java,参考这个 去着下载hadoop 解压 2. 配置 修改环境变量 vim ~/.bashrc export HADOOP_HOME= ...

  9. Hadoop安装教程_单机/伪分布式配置_Hadoop2.6.0/Ubuntu14.04

    摘自: http://www.cnblogs.com/kinglau/p/3796164.html http://www.powerxing.com/install-hadoop/ 当开始着手实践 H ...

  10. Hadoop安装教程_单机/伪分布式配置

    环境 本教程使用 CentOS 6.4 32位 作为系统环境,请自行安装系统(可参考使用VirtualBox安装CentOS).如果用的是 Ubuntu 系统,请查看相应的 Ubuntu安装Hadoo ...

随机推荐

  1. codevs——T1043 方格取数

    http://codevs.cn/problem/1043/  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond 题解  查看运行结果     题目描述 De ...

  2. javascript面向对象之Javascript 继承

    转自原文javascript面向对象之Javascript 继承 在JavaScript中实现继承可以有多种方法,下面说两种常见的. 一,call 继承 先定义一个“人”类 //人类 Person=f ...

  3. BZOJ 1044 HAOI2008 木棍切割 二分答案+动态规划

    题目大意:给定n个连在一起的木棍.分成m+1段.使每段最大值最小,求最大值的最小值及最大值最小时切割的方案数 第一问水爆了--二分答案妥妥秒过 第二问就有些难度了 首先我们令f[i][j]表示用前j个 ...

  4. Android-黑科技-微信抢红包必备软件

                        黑科技微信抢红包 介绍: 本节类容和技术无太大关系.主要是个人认为比較好玩,年关将至,对于新起之秀微信红包.绝对是过春节首选.看到就是赚到,速速围观下载.眼下仅 ...

  5. 用BFS解决迷宫问题

    在一个n*n的矩阵里走,从原点(0,0)開始走到终点(n-1,n-1),仅仅能上下左右4个方向走.仅仅能在给定的矩阵里走,求最短步数. n*n是01矩阵,0代表该格子没有障碍.为1表示有障碍物. in ...

  6. 杂项-地图:LBS

    ylbtech-杂项-地图:LBS 基于位置的服务,它是通过电信移动运营商的无线电通讯网络(如GSM网.CDMA网)或外部定位方式(如GPS)获取移动终端用户的位置信息(地理坐标,或大地坐标),在地理 ...

  7. virtualbox 安装虚拟机(centos7) 并映射本地文件夹至虚拟机(增强工具)

    一.安装环境 操作系统:windows10 virtualbox: 5.2.20 (在安装virtualbox 时可能需要 进入BIOS 设置虚拟化系统启动) centos7:http://mirro ...

  8. expdp通过dblink远端导出

    环境说明: db62是源端 rac数据库 dw03为需要导入的目标端数据库单机,实例名,服务名,字符串名都为dw03 数据库版本:11.2.0.4  操作系统:rehat 6.7 1.创建dblink ...

  9. Arduino-1602-LiquidCrystal库

    前言:LiquidCrystal是一个1602的IIC库,使用IIC协议可以极大节约用线数量,十分方便.当然,前提是1602要使用LCD1602 I2C模块. 一.库函数快速查询 LiquidCrys ...

  10. C-数据和C

    1.常量与变量数据 有些数据在程序使用之前预先设定,并在整个运行过程中没有变化,叫做常量.另外的数据在程序运行过程中可能变化或被赋值,叫做变量. 2.数据类型关键字 对于变量,编译器通过声明语句中指定 ...