搭建Hadoop2.6.4伪分布式
准备工作
操作系统
CentOS 7
软件环境
- JDK 1.7.0_79 下载地址
- SSH,正常来说是系统自带的,若没有请自行搜索安装方法
关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
设置HostName
[root@localhost ~]# hostname localhost
安装环境
安装JDK
[root@localhost ~]# tar -xzvf jdk-7u79-linux-x64.tar.gz
配置java环境变量
[root@localhost ~]# vi /etc/profile
#添加如下配置
JAVA_HOME=/root/jdk1.7.0_79
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME
export PATH
export CLASSPATH
验证java
[root@localhost ~]# java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
待输出以上内容时说明java已安装配置成功。
安装Hadoop
安装Hadoop 2.6.4
[root@localhost ~]# tar -xzvf hadoop-2.6.4.tar.gz
配置Hadoop环境变量
[root@localhost ~]# vim /etc/profile
#添加以下配置
export HADOOP_HOME=/root/hadoop-2.6.4
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin [root@localhost ~]# vim /root/hadoop-2.6.4/etc/hadoop/hadoop-env.sh
#修改以下配置
# The only required environment variable is JAVA_HOME. All others are
# optional. When running a distributed configuration it is best to
# set JAVA_HOME in this file, so that it is correctly defined on
# remote nodes. # The java implementation to use.
export JAVA_HOME=/root/jdk1.7.0_79
验证Hadoop
[root@localhost ~]# hadoop version
Hadoop 2.6.4
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r 5082c73637530b0b7e115f9625ed7fac69f937e6
Compiled by jenkins on 2016-02-12T09:45Z
Compiled with protoc 2.5.0
From source with checksum 8dee2286ecdbbbc930a6c87b65cbc010
This command was run using /root/hadoop-2.6.4/share/hadoop/common/hadoop-common-2.6.4.jar
修改Hadoop配置文件
配置文件均存放在/root/hadoop-2.6.4/etc/hadoop
<!-- core-site.xml-->
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration> <!-- hdfs-site.xml -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration> <!-- mapred-site.xml -->
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration> <!-- yarn-site.xml -->
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
SSH免密码登陆
[root@localhost ~]# ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
[root@localhost ~]# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
输入以下命令,如果不要求输入密码则表示配置成功:
[root@localhost ~]# ssh localhost
Last login: Fri May 6 05:17:32 2016 from 192.168.154.1
执行Hadoop
格式化hdfs
[root@localhost ~]# hdfs namenode -format
启动NameNode,DataNode和YARN
[root@localhost ~]# start-dfs.sh
Starting namenodes on [localhost]
localhost: starting namenode, logging to /root/hadoop-2.6.4/logs/hadoop-root-namenode-localhost.out
localhost: starting datanode, logging to /root/hadoop-2.6.4/logs/hadoop-root-datanode-localhost.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /root/hadoop-2.6.4/logs/hadoop-root-secondarynamenode-localhost.out [root@localhost ~]# start-yarn.sh
starting yarn daemons
starting resourcemanager, logging to /root/hadoop-2.6.4/logs/yarn-root-resourcemanager-localhost.out
localhost: starting nodemanager, logging to /root/hadoop-2.6.4/logs/yarn-root-nodemanager-localhost.out
向hdfs上传测试文件
首先在/root/test中建立test1.txt和test2.txt,分别输入“hello world”和“hello hadoop”并保存。
使用如下命令将文件上传至hdfs的input目录中:
[root@localhost ~]# hadoop fs -put /root/test/ input
[root@localhost ~]# hadoop fs -ls input
Found 2 items
-rw-r--r-- 1 root supergroup 12 2016-05-06 06:35 input/test1.txt
-rw-r--r-- 1 root supergroup 13 2016-05-06 06:35 input/test2.txt
执行wordcount demo
输入以下命令并等待执行结果:
[root@localhost ~]# hadoop jar /root/hadoop-2.6.4/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.4.jar wordcount input output
16/05/06 06:44:15 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
16/05/06 06:44:16 INFO input.FileInputFormat: Total input paths to process : 2
16/05/06 06:44:17 INFO mapreduce.JobSubmitter: number of splits:2
16/05/06 06:44:17 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1462530786445_0001
16/05/06 06:44:18 INFO impl.YarnClientImpl: Submitted application application_1462530786445_0001
16/05/06 06:44:18 INFO mapreduce.Job: The url to track the job: http://server1:8088/proxy/application_1462530786445_0001/
16/05/06 06:44:18 INFO mapreduce.Job: Running job: job_1462530786445_0001
16/05/06 06:44:33 INFO mapreduce.Job: Job job_1462530786445_0001 running in uber mode : false
16/05/06 06:44:33 INFO mapreduce.Job: map 0% reduce 0%
16/05/06 06:44:52 INFO mapreduce.Job: map 50% reduce 0%
16/05/06 06:44:53 INFO mapreduce.Job: map 100% reduce 0%
16/05/06 06:45:03 INFO mapreduce.Job: map 100% reduce 100%
16/05/06 06:45:03 INFO mapreduce.Job: Job job_1462530786445_0001 completed successfully
16/05/06 06:45:04 INFO mapreduce.Job: Counters: 49
File System Counters
FILE: Number of bytes read=55
FILE: Number of bytes written=320242
FILE: Number of read operations=0
FILE: Number of large read operations=0
FILE: Number of write operations=0
HDFS: Number of bytes read=249
HDFS: Number of bytes written=25
HDFS: Number of read operations=9
HDFS: Number of large read operations=0
HDFS: Number of write operations=2
Job Counters
Launched map tasks=2
Launched reduce tasks=1
Data-local map tasks=2
Total time spent by all maps in occupied slots (ms)=34487
Total time spent by all reduces in occupied slots (ms)=7744
Total time spent by all map tasks (ms)=34487
Total time spent by all reduce tasks (ms)=7744
Total vcore-milliseconds taken by all map tasks=34487
Total vcore-milliseconds taken by all reduce tasks=7744
Total megabyte-milliseconds taken by all map tasks=35314688
Total megabyte-milliseconds taken by all reduce tasks=7929856
Map-Reduce Framework
Map input records=2
Map output records=4
Map output bytes=41
Map output materialized bytes=61
Input split bytes=224
Combine input records=4
Combine output records=4
Reduce input groups=3
Reduce shuffle bytes=61
Reduce input records=4
Reduce output records=3
Spilled Records=8
Shuffled Maps =2
Failed Shuffles=0
Merged Map outputs=2
GC time elapsed (ms)=364
CPU time spent (ms)=3990
Physical memory (bytes) snapshot=515538944
Virtual memory (bytes) snapshot=2588155904
Total committed heap usage (bytes)=296755200
Shuffle Errors
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
File Input Format Counters
Bytes Read=25
File Output Format Counters
Bytes Written=25
查看执行结果
[root@localhost ~]# hadoop fs -ls output
Found 2 items
-rw-r--r-- 1 root supergroup 0 2016-05-06 06:45 output/_SUCCESS
-rw-r--r-- 1 root supergroup 25 2016-05-06 06:45 output/part-r-00000
[root@localhost ~]# hadoop fs -cat output/part-r-00000
hadoop 1
hello 2
world 1
至此,Pseudo-Distributed就已经完成了。
原创文章,转载请注明: 转载自xdlysk的博客
本文链接地址: 搭建Hadoop伪分布式[http://www.xdlysk.com/article/572c956642c817300e0f7ab1]
搭建Hadoop2.6.4伪分布式的更多相关文章
- 在Win7虚拟机下搭建Hadoop2.6.0伪分布式环境
近几年大数据越来越火热.由于工作需要以及个人兴趣,最近开始学习大数据相关技术.学习过程中的一些经验教训希望能通过博文沉淀下来,与网友分享讨论,作为个人备忘. 第一篇,在win7虚拟机下搭建hadoop ...
- CentOS5.4 搭建Hadoop2.5.2伪分布式环境
简介: Hadoop是处理大数据的主要工具,其核心部分是HDFS.MapReduce.为了学习的方便,我在虚拟机上搭建了一个伪分布式环境,来进行开发学习. 一.安装前准备: 1)linux服务器:Vm ...
- Docker中搭建Hadoop-2.6单机伪分布式集群
1 获取一个简单的Docker系统镜像,并建立一个容器. 1.1 这里我选择下载CentOS镜像 docker pull centos 1.2 通过docker tag命令将下载的CentOS镜像名称 ...
- ubuntu14.04搭建Hadoop2.9.0伪分布式环境
本文主要参考 给力星的博文——Hadoop安装教程_单机/伪分布式配置_Hadoop2.6.0/Ubuntu14.04 一些准备工作的基本步骤和步骤具体说明本文不再列出,文章中提到的“见参考”均指以上 ...
- Dockerfile完成Hadoop2.6的伪分布式搭建
在 <Docker中搭建Hadoop-2.6单机伪分布式集群>中在容器中操作来搭建伪分布式的Hadoop集群,这一节中将主要通过Dokcerfile 来完成这项工作. 1 获取一个简单的D ...
- Hadoop2.5.0伪分布式环境搭建
本章主要介绍下在Linux系统下的Hadoop2.5.0伪分布式环境搭建步骤.首先要搭建Hadoop伪分布式环境,需要完成一些前置依赖工作,包括创建用户.安装JDK.关闭防火墙等. 一.创建hadoo ...
- 琐碎-hadoop2.2.0伪分布式和完全分布式安装(centos6.4)
环境是centos6.4-32,hadoop2.2.0 伪分布式文档:http://pan.baidu.com/s/1kTrAcWB 完全分布式文档:http://pan.baidu.com/s/1s ...
- 32位Ubuntu12.04搭建Hadoop2.5.1完全分布式环境
准备工作 1.准备安装环境: 4台PC,均安装32位Ubuntu12.04操作系统,统一用户名和密码 交换机1台 网线5根,4根分别用于PC与交换机相连,1根网线连接交换机和实验室网口 2.使用ifc ...
- 摘要: CentOS 6.5搭建Redis3.2.8伪分布式集群
from https://my.oschina.net/ososchina/blog/856678 摘要: CentOS 6.5搭建Redis3.2.8伪分布式集群 前言 最近在服务器上搭建了 ...
随机推荐
- mariadb:InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
mariadb 启动中 InnoDB: Error: log file ./ib_logfile0 is of different size 0 起因:线上正在运行的系统,因为需要调整性能,变更了my ...
- Canvas 与 Paint 类的 使用
使用canvas画布和paint画笔可以自定义view 案例:fastindexbar 基本用法 public class DrawView extends View{ private Rect mR ...
- VB默认属性、动态数组、Range对象的默认属性的一点不成熟的想法
1.默认属性 VB6.0有默认属性的特性.当没有给对象指定具体的属性时,"默认属性"是VB6.0将使用的属性.在某些情形下,省略常用属性名,使代码更为精简. 因为CommandBu ...
- 公共交通3D指纹验证系统解决方案
为了响应国家关于老年人的优待政策,华本研发了退休老人乘公交车指纹认证系统.指纹认证系统不仅方便老人乘坐公交,还能为公共部门减压,杜绝伪造优待证乘坐公交的不法行为. 目前,优待证都是人工检查,缺乏有效的 ...
- jmeter+ant+jenkins+mac环境搭建
一.环境准备 1.JDK环境:http://www.oracle.com/technetwork/java/javase/downloads/index.html 2.ANT环境:http://ant ...
- Lambda表达式遍历集合
1.Collection Java 8 为Iterable接口新增了一个forEach(Consumer action)默认方法,该方法所需参数的类型是一个函数式接口,而Iterable接口是Coll ...
- MongoDB简介与增删改查
一.简介 MongoDB 是由C++语言编写的,是一个基于分布式文件存储的开源数据库系统.MongoDB 旨在为WEB应用提供可扩展的高性能数据存储解决方案.MongoDB 将数据存储为一个文档,数据 ...
- ps中的位图,矢量图,颜色模式
什么是位图?什么是矢量图? 位图是由像素组成的图像,在缩放和旋转的时候容易失真,同时文件容量较大 矢量图是根据几何特性来绘制的图形,通过数学公式计算获得的,不易制作色彩变化太多的图象 颜色模式 RGB ...
- springcloud(第三篇)springcloud eureka 服务注册与发现 *****
http://blog.csdn.net/liaokailin/article/details/51314001 ******************************************* ...
- 转!! PreparedStatement是如何防止SQL注入的
SQL注入最简单也是最常见的例子就是用户登陆这一模块,如果用户对SQL有一定的了解,同时系统并没有做防止SQL注入处理,用户可以在输入的时候加上'两个冒号作为特殊字符,这样的话会让计算机认为他输入的是 ...