wget -c http://ftp.jaist.ac.jp/pub/apache/hadoop/common/hadoop-3.0.0/hadoop-3.0.0.tar.gz
tar -zxvf hadoop-3.0.0.tar.gz -C /usr/java/
vim /etc/profile
文件export HADOOP_HOME=/usr/java/hadoop-3.0.0 export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH使之當即生效
source /etc/profile
/etc/hosts
192.168.56.101 master 192.168.56.102 slave1 192.168.56.103 slave2
systemctl stop firewalld
vim core-site.xml
文件(etc/hadoop目錄下),新增以下配置<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://master:9000</value> </property> <property> <name>hadoop.proxyuser.wujinlei.groups</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.wujinlei.hosts</name> <value>*</value> </property> </configuration>
vim hdfs-site.xml
文件,新增以下配置。
master
機器上開放端口9870
,供外部訪問web頁面(NameNode HTTP UI
),查看集羣狀況。slave
機器上開放端口9864
,供外部訪問web頁面(DataNode HTTP UI
)。<configuration> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/home/wujinlei/hadoop/dfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/home/wujinlei/hadoop/dfs/data</value> </property> <property> <name>dfs.namenode.http-address</name> <value>master:9870</value> </property> <property> <name>dfs.datanode.http.address</name> <value>master:9864</value> </property> </configuration>
vim yarn-site.xml
,新增以下配置,master
機器上開放端口8088
,供外部訪問web頁面,查看集羣任務調度狀況<configuration> <property> <name>yarn.resourcemanager.hostname</name> <value>master</value> </property> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.resourcemanager.webapp.address</name> <value>master:8088</value> </property> <property> <name>yarn.application.classpath</name> <value> /usr/java/hadoop-3.0.0/etc/hadoop, /usr/java/hadoop-3.0.0/share/hadoop/common/lib/*, /usr/java/hadoop-3.0.0/share/hadoop/common/*, /usr/java/hadoop-3.0.0/share/hadoop/hdfs, /usr/java/hadoop-3.0.0/share/hadoop/hdfs/lib/*, /usr/java/hadoop-3.0.0/share/hadoop/hdfs/*, /usr/java/hadoop-3.0.0/share/hadoop/mapreduce/*, /usr/java/hadoop-3.0.0/share/hadoop/yarn, /usr/java/hadoop-3.0.0/share/hadoop/yarn/lib/*, /usr/java/hadoop-3.0.0/share/hadoop/yarn/*, /usr/java/jdk1.8.0_45/lib/tools.jar </value> </property> <property> <name>yarn.log-aggregation-enable</name> <value>true</value> </property> </configuration>
vim mapred-site.xml
,新增以下配置<configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>mapreduce.jobhistory.address</name> <value>0.0.0.0:10020</value> </property> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>0.0.0.0:19888</value> </property> </configuration>
works
文件,內容以下slave1 slave2
slave1
和slave2
hdfs namenode -format
start-dfs.sh
start-yarn.sh
start-all.sh
http://192.168.56.101:8088
http://192.168.56.101:9870
mapred historyserver
此服務用來訪問歷史任務詳情java