環(huán)境:
Centos7.0耗拓,JDK1.8
設(shè)置主機(jī)名
hostname? hadoop1? hadoop2? hadoop3
hosts
/etc/hosts
192.168.31.17? hadoop1
192.168.31.210? hadoop2
192.168.31.65? hadoop3
免密鑰登陸
ssh-keygen -t? rsa
ssh-copy-id -i? hadoop1
ssh-copy-id -i? hadoop2
ssh-copy-id -i? hadoop3
關(guān)閉防火墻
systemctl disable firewalld
yum remove firewalld -y
下載并解壓hadoop,conf下修改
1.hadoop-env.sh
export JAVA_HOME=/usr/local/jdk/
2.core-site.xml
3.hdfs-site.xml
4.mapred-site.xml
5.masters? ? hadoop1
6.slaves? ? hadoop2? hadoop3
7.傳到其它服務(wù)器
scp? -r? ./hadoop-1.1.2? hadoop2:/root
scp? -r? ./hadoop-1.1.2? hadoop3:/root
8.運(yùn)行hadoop
hadoop的bin目錄下運(yùn)行:hadoop? namenode? -format
hadoop的bin目錄下運(yùn)行:./start-all.sh
簡(jiǎn)單例子測(cè)試
創(chuàng)建兩個(gè)數(shù)據(jù)文件
echo? "hello? world"? >test1.txt
echo? "hello? hadoop"? >test2.txt
導(dǎo)入數(shù)據(jù)文件,運(yùn)行hadoop example例子
bin/hadoop? dfs? -put? ../input? ? in
bin/hadoop? jar hadoop-examples-1.1.2.jar? wordcount? in? out
查看運(yùn)行結(jié)果
bin/hadoop? dfs? -cat? ./outs/*
web地址
http://192.168.31.17:50030/jobtracker.jsp