1.先解压hadoop.jar包
[root@bigdata ~]# tar zxf hadoop-2.6.0.tar.gz
1.1解压jkd
tar zxf jdk-7u79-linux-x64.gz
1.2 vi ~/.bash_profile
添加如下参数:
export PATH
export JAVA_HOME=$HOME/jdk1.7.0_79
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
2.cd hadoop-2.6.0/etc/hadoop/
3.配置如下文件
(1) vim hadoop-env.sh
最后一行添加: export JAVA_HOME=/root/jdk1.7.0_79
(2) vim yarn-env.sh
最后一行添加: export JAVA_HOME=/root/jdk1.7.0_79
(3) vim core-site.xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://bigdata:9000</value>
</property>
<property>
<name>io.file.buffer.size</name>
<value>131072</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/root/hadoop/tmp</value>
<description>Abase for other temporary directories</description>
</property>
<property>
<name>hadoop.proxyuser.hduser.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hduser.groups</name>
<value>*</value>
</property>
</configuration>
(4) vim hdfs-site.xml
<configuration>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>bigdata:9001</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/root/hadoop/name</value>
</property>
<property>
<name>dfs.namenode.data.dir</name>
<value>file:/root/hadoop/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
</configuration>
cp mapred-site.xml.template mapred-site.xml
(5) vim mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>bigdata:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>bigdata:19888</value>
</property>
</configuration>
(6) vim yarn-site.xml
<configuration>
<!-- Site specific YARN configuration properties -->
<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>bigdata:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>bigdata:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>bigdata:8031</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>bigdata:8033</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>bigdata:8088</value>
</property>
</configuration>
4.配置slaves
cat slaves
5. 创建目录
[root@bigdata ~]$ mkdir hadoop
[root@bigdata ~]$ cd hadoop
[root@bigdata hadoop]$ mkdir tmp
[root@bigdata hadoop]$ mkdir name
[root@bigdata hadoop]$ mkdir data
6. 复制到其它2个节点
[root@bigdata ~]$ scp -r ./hadoop-2.6.0 bigdata2:/root/
[root@bigdata ~]$ scp -r ./hadoop-2.6.0 bigdata3:/root/
7. 格式化namenode
[root@bigdata hadoop-2.6.0]$ ./bin/hdfs namenode -format
8.启动hadoop
启动hdfs:
[root@bigdata hadoop-2.6.0]# ./sbin/start-dfs.sh
关闭hdfs:
[root@bigdata hadoop-2.6.0]# ./sbin/stop-dfs.sh
启动yarn:
[root@bigdata hadoop-2.6.0]# ./sbin/start-yarn.sh
关闭yarn:
[root@bigdata hadoop-2.6.0]# ./sbin/stop-yarn.sh
查看: