vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static" ###
HWADDR="00:0C:29:3C:BF:E7"
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="ce22eeca-ecde-4536-8cc2-ef0dc36d4a8c"
IPADDR="192.168.1.101" ###
NETMASK="255.255.255.0" ###
GATEWAY="192.168.1.1" ###
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node-1
vi /etc/hosts
192.168.1.101 node-1
192.168.1.102 node-2
192.168.1.103 node-3
#查看防火墙状态
service iptables status
#关闭防火墙
service iptables stop
#查看防火墙开机启动状态
chkconfig iptables --list
#关闭防火墙开机启动
chkconfig iptables off
#生成ssh免登陆密钥
ssh-keygen -t rsa (四个回车)
执行完这个命令后,会生成两个文件id_rsa(私钥)、id_rsa.pub(公钥)
将公钥拷贝到要免密登陆的目标机器上
ssh-copy-id node-2
ssh-copy-id node-3
常用的手动进行时间的同步
date -s "2018-03-03 03:03:03"
或者网络同步:
yum install ntpdate
ntpdate cn.pool.ntp.org
rz jdk-8u65-linux-x64.tar.gz
tar -zxvf jdk-8u65-linux-x64.tar.gz -C /root/apps
vim /etc/profile
#在文件最后添加
export JAVA_HOME=/root/apps/jdk1.8.0_65
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
#刷新配置
source /etc/profile
hadoop-2.7.4-with-centos-6.7.tar.gz
tar zxvf hadoop-2.7.4-with-centos-6.7.tar.gz
注意:hadoop2.x的配置文件目录:$HADOOP_HOME/etc/hadoop
vi hadoop-env.sh
export JAVA_HOME=/root/apps/jdk1.8.0_65
说明:指定HADOOP所使用的文件系统schema(URI),HDFS的主节点(NameNode)地址
说明:指定hadoop运行时产生文件的存储目录,默认/tmp/hadoop-${user.name} -->
mv mapred-site.xml.template mapred-site.xml
vi mapred-site.xml
vi slaves
node-1
node-2
node-3
vim /etc/proflie
export JAVA_HOME=/root/apps/jdk1.8.0_65
export HADOOP_HOME=/root/apps/hadoop-2.7.4
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
source /etc/profile
hdfs namenode -format (hadoop namenode -format)
先启动HDFS
sbin/start-dfs.sh
再启动YARN
sbin/start-yarn.sh
使用jps命令验证
27408 NameNode
28218 Jps
27643 SecondaryNameNode (secondarynamenode)
28066 NodeManager
27803 ResourceManager
27512 DataNode
http://192.168.1.101:50070 (HDFS管理界面)
http://192.168.1.101:8088 (MR管理界面)