天天看点

Centos6.5 Hadoop完全分布集群搭建详解set hadoop path

#系统:centos6.5	64位
#JDK:1.7.0_79
#Hadoop:2.4.0 	64位
#注:(配置网络,首先配置好一台主机,另外的克隆主机即可)
           

一、安装SSH

yum install openssh
           

二、关闭防火墙

chkconfig iptables off
sudo gedit /etc/selinux/config  # 改为 SELINUX=disabled
           

三、修改hosts文件

sudo gedit /etc/hosts
           

把里面所有的内容使用#注释掉,然后添加主机的ip和主机名

192.168.10.110		Master
192.168.10.111		Slave1
192.168.10.112		Slave2
           

四、设置免密码登陆

ssh-keygen -t rsa		#一路空格
```					
切换到ssh的目录	
           

cd /root/.ssh cat id_rsa.pub >> authorized_keys

测试是否可以免密码登陆 
           

ssh Master

五、配置JDK
把JDK 解压到 /usr/java/ 目录下
配置JDK的环境变量 
           

sudo gedit /etc/profile #在最后一行增加以下内容: JAVA_HOME=/usr/java/jdk1.7.0_79 JRE_HOME=/usr/java/jdk1.7.0_79/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin CLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

五、配置Hadoop
解压Hadoop-2.4.0到 /usr/java 的目录下
需要配置文件:core-site.xml、hdfs-site.xml、mapred-site.xml、yarn-site.xml、hadoop-env.sh、yarn-env.sh、slaves。
1、core-site.xml
           

<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://Master:9000</value> <description>默认HDFS的路径</description> <final>true</final> </property> <property> <name>hadoop.tmp.dir</name> <value>/usr/java/hadoop-2.4.0/tmp</value> <description>临时文件夹路径</description> </property> <property> <name>io.file.buffer.size</name> <value>131072</value> <description>缓冲区的大小:io.file.buffer.size 默认4KB</description> </property> <property> <name>hadoop.proxyuser.hduser.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.hduser.groups</name> <value>*</value> </property> </configuration>

2、hdfs-site.xml
           

<configuration> <property> <name>dfs.namenode.secondary.http-address</name> <value>Master:9001</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/usr/java/hadoop-2.4.0/dfs/namenode</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/usr/java/hadoop-2.4.0/dfs/datanode</value> </property> <property> <name>dfs.replication</name> <value>3</value> </property> <property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property> </configuration>

3、mapred-site.xml
           

<configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> <description>Execution framework set to Hadoop YARN.</description> </property> <property> <name>mapreduce.jobhistory.address</name> <value>Master:10020</value> </property> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>Master:19888</value> </property> </configuration>

4、yarn-site.xml
           

<configuration> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name> <value>org.apache.hadoop.mapred.ShuffleHandler</value> </property> <property> <name>yarn.resourcemanager.address</name> <value>Master:8032</value> <description>The address of the applications manager interface in the RM.</description> </property> <property> <name>yarn.resourcemanager.scheduler.address</name> <value>Master:8030</value> <description>The address of the scheduler interface,in order for the RM to obtain the resource from scheduler</description> </property> <property> <name>yarn.resourcemanager.resource-tracker.address</name> <value>Master:8031</value> <description>The address of the resource tracker interface for the nodeManagers</description> </property> <property> <name>yarn.resourcemanager.admin.address</name> <value>Master:8033</value> <description>The address for admin manager</description> </property> <property> <name>yarn.resourcemanager.webapp.address</name> <value>Master:8088</value> <description>The address of the RM web application.</description> </property>

</configuration>

5、hadoop-env.sh     (增加JDK的安装目录)
           

export JAVA_HOME=/usr/java/jdk1.7.0_79

6、yarn-env.sh     (增加JDK的安装目录)
           

export JAVA_HOME=/usr/java/jdk1.7.0_79

7、slaves
           

Slave1 Slave2

六、配置Hadoop的环境变量
           

sudo gedit /etc/profile

set hadoop path

export HADOOP_HOME=/usr/hadoop export PATH=$PATH :$HADOOP_HOME/bin

七、克隆两台虚拟机,配置好网络。192.168.10.111   192.168.10.112
八、互相ping ip地址,看是否可以ping通。互相 ssh ip地址,看是否可以免密码登陆。
九、回到Master的主机,切换到Hadoop的目录下执行  
           

[[email protected] hadoop]$ bin/hadoop namenode -format [[email protected] hadoop]$ bin/start-all.sh

十、打开浏览器,输入 192.168.10.110:50075
看是否有两个节点。
           

版权声明:本文为CSDN博主「weixin_33851177」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/weixin_33851177/article/details/92306197