在spark1上操做node
1. 安裝Hadoop瀏覽器
$ cd /usr/localbash
$ tar -zxvf hadoop-2.4.1.tar.gzoop
$ mv hadoop-2.4.1 hadoopspa
$ vi ~/.bashrcscala
export HADOOP_HOME=/usr/local/hadoop export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
$ source .bashrcorm
2. Hadoop配置xml
$ cd /usr/local/hadoop/etc/hadoopblog
$ vi core-site.xmlhadoop
<property> <name>fs.default.name</name> <value>hdfs://spark1:9000</value> </property>
$ mkdir /usr/local/data/
$ vi hdfs-site.xml
<property> <name>dfs.name.dir</name> <value>/usr/local/data/namenode</value> </property> <property> <name>dfs.data.dir</name> <value>/usr/local/data/datanode</value> </property> <property> <name>dfs.tmp.dir</name> <value>/usr/local/data/tmp</value> </property> <property> <name>dfs.replication</name> <value>3</value> </property>
$ vi mapred-site.xml.template
<property> <name>mapreduce.framework.name</name> <value>yarn</value> </property>
$ vi yarn-site.xml
<property> <name>yarn.resourcemanager.hostname</name> <value>spark1</value> </property> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property>
$ vi slaves
spark1 spark2 spark3
$ scp -r hadoop root@spark2:/usr/local/
$ scp ~/.bashrc root@spark3:~/
在spark2和spark3的 /usr/local/ 目錄下建立 data 目錄, 以及source .bashrc
$ mkdir /usr/local/data
$ source .bashrc
在spark1上執行
# 格式化namenode $ hdfs namenode -format # 啓動集羣 $ start-dfs.sh # 查看啓動狀況 $ jps spark1 1424 SecondaryNameNode 1324 DataNode 1218 NameNode 1554 Jps spark2 1619 Jps 1555 DataNode spark3 1473 DataNode 1537 Jps
# 在瀏覽器打開 http://spark1:50070/
# 啓動yarn集羣 $ start-yarn.sh $ jps spark1 ResourceManager NodeManager spark2 NodeManager spark3 NodeManager # 在瀏覽器打開 http://spark1:8088/