CentOS 7.0默认使用的是firewall作为防火墙
查看防火墙状态 firewall-cmd --state 1
停止firewall systemctl stop firewalld.service 1
禁止firewall开机启动 systemctl disable firewalld.service 1
关闭selinux
进入到/etc/selinux/config文件 vi /etc/selinux/config 1
将SELINUX=enforcing改为SELINUX=disabled
配制免密登录的命令 ssh-keygen -t rsa
ssh-copy-id [email protected] 1
2
scp -P 22 /Users/che/Downloads/jdk-8u161-linux-x64.rpm [email protected]:/software/ 安装: yum install -y jdk-8u161-linux-x64.rpm
设置环境变量
cd /usr/java/
/usr/java/jdk1.8.0_161
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_161
export PATH=$JAVA_HOME/bin:$PATH 1
2
3
4
5
6
7
8
9
10
安装hadoop
下载安装包
hadoop-26.5.tar.gz cd /usr/
mv /software/hadoop-2.6.5.tar.gz ./
解压
tar -xzvf ./hadoop-2.6.5.tar.gz
创建目录
namenode目录:/data/hadoop/namenode
data目录: /data/hadoop/data
tmp目录: /data/hadoop/tmp
mkdir -p /data/hadoop/namenode
配制
core-site.xml
hdfs-site.xml
mapred-site.xml.template mapred-site.xml
cp mapred-site.xml.template mapred-site.xml
yarn-site.xml
slaves (slave1,slave2)
masters (master)
hadoop-env.sh
export JAVA_HOME=/usr/java/jdk1.8.0_161
将master的配制copy到slave1、slave2
scp -r ./* [email protected]:/software/hadoop-2.6.5/etc/hadoop/
格式化
cd hadoop-2.6.5/bin
./hdfs namenode -format
启动
cd ../sbin/
./start-dfs.sh
ssh-copy-id [email protected]
jps(检查一下)
./start-yarn.sh
cd ../bin
hadoop fs -ls /
hadoop fs -mkdir /user
/software/hadoop-2.6.5/bin
vi/etc/profile
export HADOOP_HOME=/software/hadoop-2.6.5
export PATH=$JAVA_HOME/bin:$HADOOP_HOME/bin:$PATH
source /etc/profile
hadoop fs -put /software/hadoop-2.6.5.tar.gz /user
测试2:
cd share/hadoop/mapreduce
hadoop jar ./hadoop-mapreduce-examples-2.6.5.jar pi 5 10
192.168.1.100:50070
192.168.1.100:8088
修改ssh端口
vim /etc/ssh/sshd_config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
设置ntp时间同步服务
1、安装ntp
yum install -y ntp
2、设置NTP服务开机启动
chkconfig ntpd on
service nptd start