说明
[server@hadoop102 wcinput]$ hostname
hadoop102
[server@hadoop102 wcinput]$ hostname -i
192.168.100.102
安装JDK
[server@hadoop102 software]$ tar -zxvf jdk-8u65-linux-x64.tar.gz -C /opt/module/
[server@hadoop102 software]$ cd /opt/module/
[server@hadoop102 module]$ cd jdk1.8.0_65/
[server@hadoop102 jdk1.8.0_65]$ pwd
/opt/module/jdk1.8.0_65
[server@hadoop102 software]$ cd /opt/module/
[server@hadoop102 module]$ cd jdk1.8.0_65/
[server@hadoop102 jdk1.8.0_65]$ pwd
/opt/module/jdk1.8.0_65
[server@hadoop102 profile.d]$ sudo vim my_env.sh
#JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_65
export PATH=$PATH:$JAVA_HOME/bin
[server@hadoop102 profile.d]$ source /etc/profile
安装Hadoop
[server@hadoop102 profile.d]$ cd /opt/software/
[server@hadoop102 software]$ tar -zxvf hadoop-3.1.3.tar.gz -C /opt/module/
[server@hadoop102 software]$ cd /opt/module/hadoop-3.1.3/
[server@hadoop102 hadoop-3.1.3]$ pwd
/opt/module/hadoop-3.1.3
[server@hadoop102 hadoop-3.1.3]$ sudo vim /etc/profile.d/my_env.sh
#JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_65
export PATH=$PATH:$JAVA_HOME/bin
#HADOOP
export HADOOP_HOME=/opt/module/hadoop-3.1.3
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
[server@hadoop102 hadoop-3.1.3]$ source /etc/profile
本地模式配置
[server@hadoop102 hadoop-3.1.3]$ pwd
/opt/module/hadoop-3.1.3
[server@hadoop102 hadoop-3.1.3]$ mkdir wcinput
[server@hadoop102 hadoop-3.1.3]$ cd wcinput/
[server@hadoop102 wcinput]$ vim word.txt
hadoop yarn
hadoop mapreduce
server
server
[server@hadoop102 wcinput]$ cd ..
[server@hadoop102 hadoop-3.1.3]$ pwd
/opt/module/hadoop-3.1.3
[server@hadoop102 hadoop-3.1.3]$ hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar wordcount wcinput/ ./wcoutput
[server@hadoop102 hadoop-3.1.3]$ cd wcoutput/
[server@hadoop102 wcoutput]$ ls -lh
总用量 4.0K
-rw-r--r--. 1 server server 37 7月 31 17:06 part-r-00000
-rw-r--r--. 1 server server 0 7月 31 17:06 _SUCCESS
[server@hadoop102 wcoutput]$ cat part-r-00000
hadoop 2
mapreduce 1
server 2
yarn 1
网友评论