hadoop第二章:本地运行模式(debug)

官方文档

1、配置java路径

[atguigu@hadoop101 hadoop-2.7.2]$ vi etc/hadoop/hadoop-env.sh

export JAVA_HOME=/opt/module/jdk1.8.0_144/

2、尝试启动hadoop

[atguigu@hadoop101 hadoop-2.7.2]$ bin/hadoop
Usage: hadoop [--config confdir] [COMMAND | CLASSNAME]
  CLASSNAME            run the class named CLASSNAME
 or
  where COMMAND is one of:
  fs                   run a generic filesystem user client
  version              print the version
  jar             run a jar file
                       note: please use "yarn jar" to launch
                             YARN applications, not this command.
  checknative [-a|-h]  check native hadoop and compression libraries availability
  distcp   copy file or directories recursively
  archive -archiveName NAME -p  *  create a hadoop archive
  classpath            prints the class path needed to get the
  credential           interact with credential providers
                       Hadoop jar and the required libraries
  daemonlog            get/set the log level for each daemon
  trace                view and modify Hadoop tracing settings

Most commands print help when invoked w/o parameters.

3、执行官方demo

[atguigu@hadoop101 hadoop-2.7.2]$ mkdir input
[atguigu@hadoop101 hadoop-2.7.2]$ cp etc/hadoop/*.xml input
[atguigu@hadoop101 hadoop-2.7.2]$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar grep input output 'dfs[a-z.]+'
略
[atguigu@hadoop101 hadoop-2.7.2]$ cat output/*
1   dfsadmin

4、执行wordcount

[atguigu@hadoop101 hadoop-2.7.2]$ mkdir wcinput
[atguigu@hadoop101 hadoop-2.7.2]$ vi wcinput/wc.input
hadoop hdfs
hadoop mapreduce
hadoop yarn
atguigu
atguigu
[atguigu@hadoop101 hadoop-2.7.2]$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount wcinput wcoutput
[atguigu@hadoop101 hadoop-2.7.2]$ cat wcoutput/*
atguigu 2
hadoop  3
hdfs    1
mapreduce   1
yarn    1

你可能感兴趣的:(hadoop第二章:本地运行模式(debug))