1.Hadoop Installation Preparation:
(1) installed linux operating system
(2) turn off the firewall
(3) is mounted on a linux JDK
2. Local pattern specific steps:
(1) extracting installation package hadoop:
tar -zxvf hadoop-2.8.4.tar.gz -C /opt/module
(2) configure the environment variables:
A Review command:
vi ~/.bash_profile //修改环境变量的文件
. B additions are as follows:
HADOOP_HOME=/opt/module/hadoop-2.8.4
export HADOOP_HOME
PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
export PATH
. c the environmental variables
enter the command:
source ~/.bash_profile
(3) modify the configuration file hadoop-env.sh
** A ** enter hadoop-2.8.4 / etc / hadoop folder.
Enter the command:
cd /opt/module/hadoop-2.8.4/etc/hadoop //进入hadoop-2.8.4/etc/hadoop文件夹
. ** b ** modify the configuration file hadoop-env.sh:
enter the command:
vi hadoop-env.sh //修改hadoop-env.sh文件
Modify the content as follows:
export JAVA_HOME=/opt/module/jdk1.8.0_144 //修改JAVAHOME地址,改为自己建的jdk地址,应该在25行
** c. ** validation (MR running a program)
(1) a.txt create a file in / root / temp directory
(2) modify the file a.txt
touch a.txt //新建a.txt文件
vi a.txt //修改a.txt
i am a tiger you are also a tiger //添加内容
(3) into the /opt/module/hadoop-2.8.4/share/hadoop/mapreduce folder
(4) Run the program wordcount hadoop jar hadoop-mapreduce-examples- 2.8.4.jar wordcount ~ / temp / a.txt ~ / temp / output / wc0717
cd /opt/module/hadoop-2.8.4/share/hadoop/mapreduce //进入文件夹
//hadoop jar 程序包 函数名 输入文件地址(这里是本地linux路径,因为本地模式没有hdfs) 输出文件地址
hadoop jar hadoop-mapreduce-examples-2.8.4.jar wordcount ~/temp/a.txt ~/temp/output/wc0717 //执行MR程序
After the successful operation, it will be in the / root / temp / output / folder, production under wc0717 file, two files part-r-000000 and _SUCCESS this folder