您好,登錄后才能下訂單哦!
jdk下載地址 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 添加hadoop用戶 [root@centos67 ~]# useradd hadoop [root@centos67 ~]# passwd hadoop [root@centos67 ~]# ssh-keygen #生成密鑰 [root@centos67 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop@127.0.0.1 將主機名寫入hosts文件中 [root@centos67 ~]# echo "127.0.0.1 `hostname`" >> /etc/hosts 下載jdk-8u71-linux-x64.tar.gz [root@centos67 ~]# tar xf jdk-8u71-linux-x64.tar.gz -C /usr/local/ [root@centos67 ~]# cd /usr/local/ [root@centos67 local]# mv jdk1.8.0_71 java [root@centos67 ~]# vim /etc/profile.d/java.sh #!/bin/bash export JAVA_HOME=/usr/local/java #這里是你對應的jdk目錄 export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin [root@centos67 ~]# bash /etc/profile.d/java.sh 測試jdk是否安裝成功 [root@centos67 ~]# java -version java version "1.8.0_71" Java(TM) SE Runtime Environment (build 1.8.0_71-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode) hadoop下載地址 http://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-2.6.3/hadoop-2.6.3.tar.gz 下載hadoop-2.6.3.tar.gz [root@centos67 ~]# tar xf hadoop-2.6.3.tar.gz -C /usr/local/ [root@centos67 ~]# cd /usr/local/ [root@centos67 local]# mv hadoop-2.6.3 hadoop [root@centos67 ~]# vim /etc/profile.d/hadoop.sh #!/bin/bash export HADOOP_HOME=/usr/local/hadoop export PATH=$PATH:$HADOOP_HOME/bin [root@centos67 ~]# bash /etc/profile.d/hadoop.sh 測試hadoop是否安裝成功 [root@centos67 ~]# hadoop version Hadoop 2.6.3 Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r cc865b490b9a6260e9611a5b8633cab885b3d247 Compiled by jenkins on 2015-12-18T01:19Z Compiled with protoc 2.5.0 From source with checksum 722f77f825e326e13a86ff62b34ada This command was run using /usr/local/hadoop/share/hadoop/common/hadoop-common-2.6.3.jar 下面開始正式的配置hadoop 涉及到的文件有: /usr/local/hadoop/etc/hadoop/ hadoop-env.sh yarn-env.sh yarn-site.xml core-site.xml hdfs-site.xml mapred-site.xml 修改hadoop-env.sh配置文件 [root@centos67 ~]# cd /usr/local/hadoop/etc/hadoop [root@centos67 ~]# vim hadoop-env.sh #添加以下內容 export JAVA_HOME=/usr/local/java export HADOOP_PREFIX=/usr/local/hadoop 修改yarn-env.sh配置文件,將以下內容替換 [root@centos67 ~]# sed -i 's@^JAVA_HOME=$JAVA_HOME@JAVA_HOME=/usr/local/java@' yarn-env.sh 修改core-site.xml配置文件,配置hdfs的訪問地址和端口 [root@centos67 ~]# vim core-site.xml <configuration> <property> <name>fs.default.name</name> <value>hdfs://centos67:9000</value> <description>hdfs的訪問地址</description> </property> <property> <name>hadoop.tmp.dir</name> <value>/home/hadoop/tmp/</value> <description>hdfs的臨時目錄</description> </property> </configuration> 修改hdfs-site.xml配置文件,備份方式默認為3,我的是單機模式,所以改為1了 [root@centos67 ~]# mkdir -p /home/hadoop/hdfs/{name,data} [root@centos67 ~]# chown -R hadoop:hadoop /home/hadoop/hdfs [root@centos67 ~]# vim hdfs-site.xml <configuration> <property> <name>dfs.name.dir</name> <value>file:/home/hadoop/hdfs/name</value> </property> <property> <name>dfs.data.dir</name> <value>file:/home/hadoop/hdfs/data</value> </property> <property> <name>dfs.replication</name> <value>1</value> </property> </configuration> 修改hadoop配置文件MapReduce的配置文件mapred-site.xml, [root@centos67 ~]# vim mapred-site.xml <configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> </configuration> 修改hadoop配置文件yarn-site.xml [root@centos67 ~]# vim yarn-site.xml <configuration> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.resourcemanager.webapp.address</name> <value>${yarn.resourcemanager.hostname}:8099</value> </property> </configuration> 至此,hadoop可以格式化并啟動了。 [root@centos67 ~]# hadoop namenode -format [root@centos67 ~]# /usr/local/hadoop/sbin/start-dfs.sh [root@centos67 ~]# jps 1472 DataNode 1660 SecondaryNameNode 2159 Jps 1375 NameNode 有這么幾個進程,說明已經成功啟動了 [root@centos67 ~]# /usr/local/hadoop/sbin/start-yarn.sh 1472 DataNode 2294 NodeManager 2392 Jps 1660 SecondaryNameNode 2205 ResourceManager 1375 NameNode 查看是否有9000端口 [root@centos67 ~]# netstat -lnpt | grep 9000 網頁訪問 http://localhost:50070
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。