Hadoop2.7.4完全分布式集群构建实战总结

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hadoop2.7.4完全分布式集群构建实战总结相关的知识,希望对你有一定的参考价值。

配置Linux环境
配置好各虚拟机的网络(采用NAT联网模式)
通过Linux图形界面进行修改(桌面版本Centos):进入Linux图形界面 -> 右键点击右上方的两个小电脑 -> 点击Edit connections-> 选中当前网络System eth0 -> 点击edit按钮 -> 选择IPv4 -> method选择为manual ->点击add按钮 -> 添加IP:192.168.1.101 子网掩码:255.255.255.0 网关:192.168.1.1 -> apply
修改配置文件方式
????????????? 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???

修改主机名和IP的映射关系
????????????? 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免登陆密钥

?????? 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

安装JDK并配置环境变量
上传jdk
????????????? rz jdk-8u65-linux-x64.tar.gz

解压jdk
????????????? tar -zxvf jdk-8u65-linux-x64.tar.gz -C /root/apps

将java添加到环境变量中
????????????? 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

安装hadoop2.7.4
上传hadoop的安装包到服务器
?????? ???? 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

配置hadoop的核心配置文件
配置文件hadoop-env.sh
vi hadoop-env.sh

export JAVA_HOME=/root/apps/jdk1.8.0_65

配置文件core-site.xml
说明:指定HADOOP所使用的文件系统schema(URI),HDFS的主节点(NameNode)地址

<property>

?????? ?????? <name>fs.defaultFS</name>

?????? ?????? <value>hdfs://node-1:9000</value>

</property>

说明:指定hadoop运行时产生文件的存储目录,默认/tmp/hadoop-${user.name} -->

<property>

?????? ?????? <name>hadoop.tmp.dir</name>

?????? ?????? <value>/home/hadoop/hadoop-2.4.1/tmp</value>

</property>

配置文件hdfs-site.xml?

?????? ?????? dfs.replication ?????? ?????? 2 ?????? ????? dfs.namenode.secondary.http-address ? ??? ??????node-2:50090 配置文件mapred-site.xml mv mapred-site.xml.template mapred-site.xml vi mapred-site.xml ?????? ?????? mapreduce.framework.name ?????? ?????? yarn 配置文件yarn-site.xml ?????? ????? yarn.resourcemanager.hostname ?????? ????? node-1 ?????? ?????? yarn.nodemanager.aux-services ?????? ????? mapreduce_shuffle 配置文件slaves,里面写上从节点所在的主机名字 vi slaves node-1 node-2 node-3 将hadoop添加到环境变量 ?????? 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 格式化namenode(本质是对namenode进行初始化) ?????? hdfs namenode -format (hadoop namenode -format) 启动hadoop,验证是否启动成功 ?????? 先启动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管理界面)

以上是关于Hadoop2.7.4完全分布式集群构建实战总结的主要内容,如果未能解决你的问题,请参考以下文章

HPC大规模集群下的Hadoop2.5+Zookeeper3.4+Giraph1.2的配置安装与应用

HPC大规模集群下的Hadoop2.5+Zookeeper3.4+Giraph1.2的配置安装与应用

大数据实战之Centos搭建完全分布式Hadoop集群

大数据开发基础入门与项目实战Hadoop核心及生态圈技术栈之1.Hadoop简介及Apache Hadoop完全分布式集群搭建

windows下部署Hadoop2.7.4

Kubesnetes实战总结 - 部署高可用集群