sudo chrown -R hadoop:hadoop /opt/*
tar -zxf hadoop-2.5.0.tar.gz -C /opt/modules/ (删除doc下的帮助文档,节省空间) rm -rf /opt/modules/hadoop-2.5.0/share/doc/
cd /opt/modules/hadoop-2.5.0/etc/hadoop vi hadoop-env.shexport JAVA_HOME=/usr/local/jdk1.7.0_67 验证是否配置成功 /opt/modules/hadoop-2.5.0/bin/hadoop
<!--指定namenode所在机器的位置和访问交互端口号--><property> <name>fs.defaultFS</name> <value>hdfs://hadoop.lianwei.org(主机名):8020</value></property><!--指定Hadoop运行时的临时目录--><property> <name>hadoop.tmp.dir</name> <value>/opt/modules/hadoop-2.5.0/data/tmp</value></property>
vi /opt/module/hadoop-2.5.0/etc/hadoop/slaves 将内容改为指定datanode所在机器位置:hadoop.lianwei.org
vi /opt/module/hadoop-2.5.0/etc/hadoop/hdfs-site.xml<!--指定系统中文件的块的副本个数--><property> <name>dfs.replication</name> <value>1</value>(分布式中默认是3个)</property>
bin/hdfs namenode -format 注:会在hadoop.tmp.dir下生成dfs/name/current/fsimage_*(镜像文件)
sbin/hadoop-daemon.sh start namenode sbin/hadoop-daemon.sh start datanodejps(查看是否启动成功)
http://hadoop.lianwei.org:50070
<property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value></property>指定resorcemanager所在机器的位置:<property> <name>yarn.resourcemanager.hostname</name> <value>hadoop.lianwei.org</value></property>
$ sbin/yarn-daemon.sh start resourcemanager $ sbin/yarn-daemon.sh start nodemanager
http://hadoop.lianwei.org:8088
指定mapreduce运行在YARN上<property> <name>mapreduce.framework.name</name> <value>yarn</value></property>
在HDFS中创建待处理文件目录 bin/hdfs dfs -mkdir -p /user/lianwei/mapreduce/examples/wordcount/input 上传待处理文件到HDFS中的待处理目录中 bin/hdfs dfs -put /opt/data/lv.input /user/lianwei/mapreduce/examples/wordcount/input 执行命令 bin/yarn jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5.0.jar wordcount /user/lianwei/mapreduce/examples/wordcount/input /user/lianwei/mapreduce/examples/wordcount/output(输出目录不能手动创建且不能存在,否则会覆盖)
注意事项:
1、centos之前的版本防火墙是iptables,但是centos7.0默认使用的是firewall作为防火墙 systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启动firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
本文出自 “11954530” 博客,请务必保留此出处http://11964530.blog.51cto.com/11954530/1837650
原文地址:http://11964530.blog.51cto.com/11954530/1837650