環境node
1, JDK8 --> 位置: /opt/jdk8web
2, Hadoop2.10: --> 位置: /opt/bigdata/hadoop210shell
3, CentOS 7虛擬機試驗集羣規劃vim
cd /opt/bigdata tar -zxvf hadoop-2.10.1.tar.gz mv ./hadoop-2.10.1 hadoop210
cd /opt/bigdata/hadoop210/etc/hadoop/
[root@node1 hadoop27]# echo $JAVA_HOME /opt/jdk8 vim hadoop-env.sh
export JAVA_HOME=/opt/jdk8
[root@node1 hadoop210]# pwd /opt/bigdata/hadoop210 [root@node1 hadoop210]# mkdir hadoopDatas [root@node1 hadoop210]# cd /opt/bigdata/hadoop210/etc/hadoop/ [root@node1 hadoop210]# vim core-site.xml
<configuration> <property> <name>fs.default.name</name> <value>hdfs://node1:8020</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/opt/bigdata/hadoop210/hadoopDatas/tempDatas</value> </property> <!-- 緩衝區大小,實際工做中根據服務器性能動態調整 --> <property> <name>io.file.buffer.size</name> <value>4096</value> </property> <!-- 開啓hdfs的垃圾桶機制,刪除掉的數據能夠從垃圾桶中回收,單位分鐘 --> <property> <name>fs.trash.interval</name> <value>10080</value> </property> </configuration>
[root@node1 hadoop]# cd /opt/bigdata/hadoop210/etc/hadoop/ [root@node1 hadoop]# vi hdfs-site.xml
<configuration> <property> <name>dfs.namenode.secondary.http-address</name> <value>node1:50090</value> </property> <property> <name>dfs.namenode.http-address</name> <value>node1:50070</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:///opt/bigdata/hadoop210/hadoopDatas/namenodeDatas</value> </property> <!-- 定義dataNode數據存儲的節點位置,實際工做中,通常先肯定磁盤的掛載目錄,而後多個目錄用,進行分割 --> <property> <name>dfs.datanode.data.dir</name> <value>file:///opt/bigdata/hadoop210/hadoopDatas/datanodeDatas</value> </property> <property> <name>dfs.namenode.edits.dir</name> <value>file:///opt/bigdata/hadoop210/hadoopDatas/nn/edits</value> </property> <property> <name>dfs.namenode.checkpoint.dir</name> <value>file:///opt/bigdata/hadoop210/hadoopDatas/snn/name</value> </property> <property> <name>dfs.namenode.checkpoint.edits.dir</name> <value>file:///opt/bigdata/hadoop210/hadoopDatas/dfs/snn/edits</value> </property> <property> <name>dfs.replication</name> <value>3</value> </property> <property> <name>dfs.permissions</name> <value>false</value> </property> <property> <name>dfs.blocksize</name> <value>134217728</value> </property> </configuration>
[root@node1 hadoop]# vi yarn-site.xml
<configuration> <property> <name>yarn.resourcemanager.hostname</name> <value>node1</value> </property> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.log-aggregation-enable</name> <value>true</value> </property> <property> <name>yarn.log-aggregation.retain-seconds</name> <value>604800</value> </property> <property> <name>yarn.nodemanager.resource.memory-mb</name> <value>20480</value> </property> <property> <name>yarn.scheduler.minimum-allocation-mb</name> <value>2048</value> </property> <property> <name>yarn.nodemanager.vmem-pmem-ratio</name> <value>2.1</value> </property> </configuration>
[root@node1 hadoop]# vi mapred-env.sh
export JAVA_HOME=/opt/jdk8
[root@node1 hadoop]# mv mapred-site.xml.template ./mapred-site.xml [root@node1 hadoop]# vi mapred-site.xml
<configuration> <property> <name>mapreduce.job.ubertask.enable</name> <value>true</value> </property> <property> <name>mapreduce.jobhistory.address</name> <value>node1:10020</value> </property> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>node1:19888</value> </property> </configuration>
[root@node1 hadoop]# vi slaves
node1 node2 node3
[root@node1 hadoop]# vi /etc/profile
export HADOOP_HOME=/opt/bigdata/hadoop210 export PATH=:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$FINDBUGS_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH
[root@node1 hadoop]# source /etc/profile
[root@node1 hadoop210]# cd /opt/bigdata/hadoop210/ [root@node1 hadoop210]# scp -r hadoop210 node2:$PWD [root@node1 hadoop210]# scp -r hadoop210 node3:$PWD [root@node1 hadoop210]# scp /etc/profile node2:/etc/ [root@node1 hadoop210]# scp /etc/profile node3:/etc/
分別在node2,node3節點機器執行如下命令: 刷新加載/etc/profile服務器
source /etc/profile
前提: 3臺機器上安裝好了zookeeper, 並啓動app
zkServer.sh start
要啓動 Hadoop 集羣,須要啓動 HDFS 和 YARN 兩個模塊。 注意: 首次啓動 HDFS 時,必須對其進行格式化操做。 本質上是一些清理和 準備工做,由於此時的 HDFS 在物理上仍是不存在的。webapp
在node1節點機器執行如下命令jsp
[root@node1 bigdata]# hdfs namenode -format
[root@node1 bigdata]# start-dfs.sh
[root@node1 bigdata]# start-yarn.sh
[root@node1 bigdata]# mr-jobhistory-daemon.sh start historyserver
啓動完成以後, 能夠經過jsp查看oop