1.关闭防火墙service iptables stop,(已经这是开机关闭的忽略)
2.进入hadoop目录,修改hadoop配置文件(4个)
core-site.xml
<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://localhost.localdomain:8020</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/usr/local/hadoop/data/tmp</value> </property> </configuration>
hdfs-site.xml
<configuration> <property> <name>dfs.replication</name> <value>1</value> </property> </configuration>
yarn-site.xml
<configuration> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.resourcemanager.hostname</name> <value>192.168.41.134</value> </property> <property> <name>yarn.log-aggregation-enable</name> <value>true</value> </property> <property> <name>yarn.log-aggregation.retain-seconds</name> <value>640800</value> </property> </configuration>
mapred-site.xml
<configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>mapreduce.jobhistory.address</name> <value>192.168.41.134:10020</value> </property> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>192.168.41.134:19888</value> </property> </configuration>
3.开启服务
1.开始namenode节点
sbin/hadoop-daemon.sh start namenode
2.开始datanode节点
sbin/hadoop-daemon.sh start datanode
3.开启resourcemanager
sbin/yarn-daemon.sh resourcemanager
4.开启nodemanager
sbin/yarn-daemon.sh stop nodemanager
5.开启日志服务
sbin/mr-jobhistory-daemon.sh start historyserver
6.运行测试程序(最后一个单词output不可以存在,如果可以换个名字)
bin/yarn jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5.0.jar wordcount /user/hub/mapreduce/wordcount/input /user/hub/mapreduce/wordcount/output
3.查看HDFS的使用情况
http://192.168.41.134:50070
3.1 虚拟机下面查看HDFS的文件(命令与linux类似,前面要加上-)
bin/hdfs dfs -ls /user/hub/...
3.2 删除文件的时候 -rm -R可以直接删除文件夹
4.查看应用程序的运行情况
http://192.168.41.134:8088
5.查看hadoop官方文档
http://hadoop.apache.org
6.查看hadoop的历史版本(全)
http://archive.apache.org/dist/
时间: 2024-10-09 14:22:50