问题导读: 1.详细讲解hadoop2.4.1完全分布式安装的各个步骤? 2.需要修改哪些配置文件 扩展: 完全分布于为分布的区别是什么?
1、JDK安装和SSH互信(略过) 参考:
2、各节点IP和hostname如下(各节点需配置)
- [hadoop@master ~]$ cat /etc/hosts
复制代码
- 127.0.0.1 localhost
- 100.12.56.221 slave-1
- 100.12.56.222 slave-2
- 100.12.56.223 slave-3
- 100.12.56.224 slave-4
- 100.12.56.227 slave-5
- 100.12.56.228 master
复制代码
3、各节点操作使用hadoop用户进行,hadoop安装目录在/home/hadoop/hadoop-2.4.1下
4、JAVA环境变量配置如下
- [hadoop@master hadoop-2.4.1]$ cat /etc/profile(各节点需配置)
复制代码
- export JAVA_HOME=/usr/java/jdk1.7.0_51
- export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
- export PATH=.:$JAVA_HOME/bin:$PATH
- export PATH=/home/hadoop/hadoop-2.4.1/bin:/home/hadoop/hadoop-2.4.1/bin:$PATH
- #该环境变量的配置,让shell能够查找到hadoop的类路径
复制代码
5、master创建下这几个目录(这几个目录不知道是否必须创建,本例实验时创建了目录,实验成功)
- mkdir -p /home/hadoop/tmp
- mkdir -p /home/hadoop/dfs/name
- mkdir -p /home/hadoop/dfs/data
复制代码
6、编辑hadoop-env.sh(master节点)
- vi /home/hadoop/hadoop-2.4.1/etc/hadoop/hadoop-env.sh
复制代码
- #添加如下内容
- export JAVA_HOME=/usr/java/jdk1.7.0_51
复制代码
7、编辑yarn-env.sh(master节点)
- vi /home/hadoop/hadoop-2.4.1/etc/hadoop/yarn-env.sh
复制代码
- #添加如下内容
- export JAVA_HOME=/usr/java/jdk1.7.0_51
复制代码
8、编辑slaves(master节点)
- vi /home/hadoop/hadoop-2.4.1/etc/hadoop/slaves
复制代码
- #添加如下内容
- slave-1
- slave-2
- slave-3
- slave-4
- slave-5
复制代码
9、编辑core-site.xml(master节点)
- vi /home/hadoop/hadoop-2.4.1/etc/hadoop/core-site.xml
复制代码
- #添加如下内容
- <configuration>
- <property>
- <name>fs.defaultFS</name>
- <value>hdfs://master:8020</value>
- </property>
- <property>
- <name>io.file.buffer.size</name>
- <value>131072</value>
- </property>
- <property>
- <name>hadoop.tmp.dir</name>
- <value>file:/home/hadoop/tmp</value>
- <description>Abase for other temporary directories.</description>
- </property>
- <property>
- <name>hadoop.proxyuser.hadoop.hosts</name>
- <value>*</value>
- </property>
- <property>
- <name>hadoop.proxyuser.hadoop.groups</name>
- <value>*</value>
- </property>
- </configuration>
复制代码
10、编辑hdfs-site.xml(master节点)
- vi /home/hadoop/hadoop-2.4.1/etc/hadoop/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:/home/hadoop/dfs/name</value>
- </property>
- <property>
- <name>dfs.datanode.data.dir</name>
- <value>file:/home/hadoop/dfs/data</value>
- </property>
- <property>
- <name>dfs.replication</name>
- <value>3</value>
- </property>
- <property>
- <name>dfs.webhdfs.enabled</name>
- <value>true</value>
- </property>
- </configuration>
复制代码
11、编辑mapred-site.xml(master节点)
- vi /home/hadoop/hadoop-2.4.1/etc/hadoop/mapred-site.xml
复制代码
- <configuration>
- <property>
- <name>mapreduce.framework.name</name>
- <value>yarn</value>
- </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>
复制代码
12、编辑yarn-site.xml(master节点)
- vi /home/hadoop/hadoop-2.4.1/etc/hadoop/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>
- </property>
- <property>
- <name>yarn.resourcemanager.scheduler.address</name>
- <value>master:8030</value>
- </property>
- <property>
- <name>yarn.resourcemanager.resource-tracker.address</name>
- <value>master:8031</value>
- </property>
- <property>
- <name>yarn.resourcemanager.admin.address</name>
- <value>master:8033</value>
- </property>
- <property>
- <name>yarn.resourcemanager.webapp.address</name>
- <value>master:8088</value>
- </property>
- </configuration>
复制代码
13、拷贝软件到其他节点(master节点)
- scp -r /home/hadoop/hadoop-2.4.1 slave-1:/home/hadoop/
- scp -r /home/hadoop/hadoop-2.4.1 slave-2:/home/hadoop/
- scp -r /home/hadoop/hadoop-2.4.1 slave-3:/home/hadoop/
- scp -r /home/hadoop/hadoop-2.4.1 slave-4:/home/hadoop/
- scp -r /home/hadoop/hadoop-2.4.1 slave-5:/home/hadoop/
复制代码
14、格式化hdfs文件系统(master节点)
复制代码
15、启动yarn
- /home/hadoop/hadoop-2.4.1/sbin/start-yarn.sh(master节点)
复制代码
16、jps
master节点:
- [hadoop@master sbin]$ jps
复制代码
- 8783 NameNode
- 8981 SecondaryNameNode
- 9759 Jps
- 9132 ResourceManager
复制代码
slave节点:
复制代码
- 6911 DataNode
- 7035 NodeManager
- 7281 Jps
复制代码
17、网页上访问
http://master:8088/
|