Hadoop 2.5.2版本安裝部署
軟體及版本:
Hadoop版本 |
hadoop-2.5.2 |
|
作業系統 |
Red Hat Linux 6.4 |
32bit |
JDK版本 |
jdk-8u25-linux-i586.rpm |
|
軟體準備:
下載hadoop-2.5.2:
wget
下載JDK:jdk-8u25-linux-i586.rpm
總體的流程如下:
1、實現ssh無密碼驗證配置
2、安裝jdk,並配好環境變數
3、安裝與配置Hadoop
4、格式化與啟動
5、驗證是否啟動
一.主機之間SSH無密碼驗證
利用 : ssh-kengen
–t rsa 命令產生公鑰,將個主機之間的公鑰,相互複製到authorized_keys檔案內。
二.安裝JDK
安裝好後,用java -version 檢驗下
配置環境變數:
點選(此處)摺疊或開啟
- ###set java_env
- export JAVA_HOME=/usr/java/jdk1.8.0_25/
- export JRE_HOME=/usr/java/jdk1.8.0_25/jre
- export CLASS_PATH=.:$CLASS_PATH:$JAVA_HOME/lib:$JRE_HOME/lib
- export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
- ###set hadoop_env
- export HADOOP_HOME=/home/zhang/hadoop-2.5.2
- export HADOOP_COMMON_HOME=$HADOOP_HOME
- export HADOOP_HDFS_HOME=$HADOOP_HOME
- export HADOOP_MAPRED_HOME=$HADOOP_HOME
- export HADOOP_YARN_HOME=$HADOOP_HOME
- export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
- export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HADOOP_HOME/lib
- export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
- export HADOOP_OPTS=\"-Djava.library.path=$HADOOP_HOME/lib\"
三.部署配置Hadoop
解壓Hadoop 到 自己的hadoop 目錄
配置相關的配置檔案
2.5.x版本的配置檔案在:$Hadoop_Home/etc/hadoop 目錄下
2.X版本較1.X版本改動很大,主要是用Hadoop MapReduceV2(Yarn) 框架代替了一代的架構,其中JobTracker 和 TaskTracker 不見了,取而代之的是 ResourceManager, ApplicationMaster 與 NodeManager 三個部分,而具體的配置檔案位置與內容也都有了相應變化,具體的可參考文獻:http://www.ibm.com/developerworks/cn/opensource/os-cn-hadoop-yarn/
(1)hadoop/etc/hadoop/hadoop-env.sh 與 hadoop/etc/hadoop/yarn-env.sh來配置兩個檔案裡的JAVA_HOME
(2)etc/hadoop/core-site.xml,配置為:
點選(此處)摺疊或開啟
-
<configuration>
-
-
<property>
-
<name>hadoop.tmp.dir</name>
-
<value>/home/zhang/hadoop-2.5.2/tmp</value>
-
<description>A base for other temporary directories.</description>
-
</property>
-
-
<property>
-
<name>fs.default.name</name>
-
<value>hdfs://namenode:9000</value>
-
</property>
-
-
<property>
-
<name>io.file.buffer.size</name>
-
<value>131072</value>
-
</property>
-
-
<property>
-
<name>hadoop.proxyuser.root.hosts</name>
-
<value>namenode</value>
-
</property>
-
-
<property>
-
<name>hadoop.proxyuser.root.groups</name>
-
<value>*</value>
-
</property>
-
-
- </configuration>
(3)etc/hadoop/hdfs-site.xml,配置為: (注意:這裡需要自己手動用mkdir建立name和data資料夾,具體位置也可以自己選擇,其中dfs.replication的值建議配置為與分散式 cluster 中實際的 DataNode 主機數一致。)
點選(此處)摺疊或開啟
-
<configuration>
-
<property>
-
<name>dfs.namenode.name.dir</name>
-
<value>/home/zhang/hadoop-2.5.2/hdfs/name</value>
-
<final>true</final>
-
</property>
-
-
<property>
-
<name>dfs.datanode.data.dir</name>
-
<value>/home/zhang/hadoop-2.5.2/hdfs/data</value>
-
<final>true</final>
-
</property>
-
-
<property>
-
<name>dfs.replication</name>
-
<value>2</value>
-
</property>
-
-
<property>
-
<name>dfs.permissions</name>
-
<value>false</value>
-
</property>
-
- </configuration>
(4)etc/hadoop/mapred-site.xml,配置為:
點選(此處)摺疊或開啟
-
<configuration>
-
<property>
-
<name>mapreduce.framework.name</name>
-
<value>Yarn</value>
-
</property>
-
-
<property>
-
<name>mapreduce.jobhistory.address</name>
-
<value>namenode:10020</value>
-
</property>
-
-
<property>
-
<name>mapreduce.jobhistory.webapp.address</name>
-
<value>namenode:19888</value>
-
</property>
-
-
<property>
-
<name>mapreduce.jobhistory.intermediate-done-dir</name>
-
<value>/mr-history/tmp</value>
-
</property>
-
-
<property>
-
<name>mapreduce.jobhistory.done-dir</name>
-
<value>/mr-history/done</value>
-
</property>
-
- </configuration>
(5)etc/hadoop/yarn-site.xml對yarn進行配置:
點選(此處)摺疊或開啟
-
<configuration>
-
-
<!-- Site specific YARN configuration properties -->
-
-
<property>
-
<name>Yarn.nodemanager.aux-services</name>
-
<value>mapreduce.shuffle</value>
-
</property>
-
-
<property>
-
<name>Yarn.resourcemanager.address</name>
-
<value>namenode:18040</value>
-
</property>
-
-
<property>
-
<name>Yarn.resourcemanager.scheduler.address</name>
-
<value>namenode:18030</value>
-
</property>
-
-
<property>
-
<name>Yarn.resourcemanager.resource-tracker.address</name>
-
<value>namenode:18025</value>
-
</property>
-
-
<property>
-
<name>Yarn.resourcemanager.admin.address</name>
-
<value>namenode:18041</value>
-
</property>
-
-
<property>
-
<name>Yarn.resourcemanager.webapp.address</name>
-
<value>namenode:8088</value>
-
</property>
-
-
<property>
-
<name>Yarn.nodemanager.local-dirs</name>
-
<value>/home/zhang/hadoop-2.5.2/mynode/my</value>
-
</property>
-
-
<property>
-
<name>Yarn.nodemanager.log-dirs</name>
-
<value>/home/zhang/hadoop-2.5.2/mynode/logs</value>
-
</property>
-
-
<property>
-
<name>Yarn.nodemanager.log.retain-seconds</name>
-
<value>10800</value>
-
</property>
-
-
<property>
-
<name>Yarn.nodemanager.remote-app-log-dir</name>
-
<value>/logs</value>
-
</property>
-
-
<property>
-
<name>Yarn.nodemanager.remote-app-log-dir-suffix</name>
-
<value>logs</value>
-
</property>
-
-
<property>
-
<name>Yarn.log-aggregation.retain-seconds</name>
-
<value>-1</value>
-
</property>
-
-
<property>
-
<name>Yarn.log-aggregation.retain-check-interval-seconds</name>
-
<value>-1</value>
-
</property>
-
-
- </configuration>
四.啟動測試
(1)用scp 命令將hadoop資料夾複製到所有的節點機器相同路徑上。
(2)驗證一下SSH 無密碼訪問已經沒有問題了
(3)關閉防火牆
如果不關閉的話可能造成,無法訪問埠的問題。不關閉防火牆也可以將對應的相關埠開啟比如 namenode上:9000埠
方法:http://blog.itpub.net/28929558/viewspace-1353996/
(4)啟動測試
格式化:namdenode
hadoop/bin/hadoop namenode -format
檢視列印資訊的倒數第三行:Storage directory ~/hadoop-2.5.2/hdfs/name has been successfully formatted
則說明成功了!
啟動 hdfs :
sbin/start-dfs.sh
jps 檢視 namenode 上: NameNode SecondaryNameNode
datanode shang : DataNode
啟動 yarn :start-yarn.sh
jps 檢視 namenode 上: NameNode SecondaryNameNode ResourceManager
datanode shang : DataNode NodeManager
用 hdfs dfsadmin -report 檢驗一下
9189 NameNode
[zhang@namenode sbin]$ hdfs dfsadmin -report
14/12/01 23:19:15 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Configured Capacity: 8177262592 (7.62 GB)
Present Capacity: 4473057280 (4.17 GB)
DFS Remaining: 4473032704 (4.17 GB)
DFS Used: 24576 (24 KB)
DFS Used%: 0.00%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
-------------------------------------------------
Live datanodes (1):
Name: 10.0.128.124:50010 (datanode01)
Hostname: datanode01
Decommission Status : Normal
Configured Capacity: 8177262592 (7.62 GB)
DFS Used: 24576 (24 KB)
Non DFS Used: 3704205312 (3.45 GB)
DFS Remaining: 4473032704 (4.17 GB)
DFS Used%: 0.00%
DFS Remaining%: 54.70%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Mon Dec 01 23:19:15 PST 2014
測試放入資料檔案,並檢視:
[zhang@namenode sbin]$ hadoop fs -put ../../input/ /input
14/12/02 00:18:01 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[zhang@namenode sbin]$ hadoop fs -cat /input/test.txt
14/12/02 00:18:35 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
hello word !
驗證完畢!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28929558/viewspace-1354180/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Hadoop 安裝部署Hadoop
- Hadoop安裝部署Hadoop
- hadoop的安裝部署Hadoop
- Hadoop叢集部署安裝Hadoop
- windows下安裝部署 hadoopWindowsHadoop
- 高可用Hadoop平臺-Ganglia安裝部署Hadoop
- centos6下安裝部署hadoop2.2CentOSHadoop
- Ganglia監控Hadoop叢集的安裝部署Hadoop
- 【Hadoop】大資料安裝部署之虛擬機器的安裝Hadoop大資料虛擬機
- Hadoop CDH版本安裝和啟動(CentOS7)HadoopCentOS
- 完全分散式Hadoop叢集的安裝部署步驟分散式Hadoop
- 離線安裝Hadoop最新發行版本hdp2.4Hadoop
- Hadoop安裝指引Hadoop
- eclipse安裝Hadoop1.1.2版本開發外掛EclipseHadoop
- hadoop window下安裝Hadoop
- linux hadoop安裝LinuxHadoop
- Hadoop2.9.0安裝Hadoop
- Zabbix安裝部署
- canal安裝部署
- Doris安裝部署
- greenplum安裝部署
- SQLT 安裝部署SQL
- ZooKeeper 安裝部署
- Dubbo安裝部署
- Zookeeper安裝部署
- ELK安裝部署
- chromedriver安裝部署Chrome
- Hadoop入門系列(2)-安裝HadoopHadoop
- Centos7安裝安裝部署dockerCentOSDocker
- Hadoop(一)Hadoop核心架構與安裝Hadoop架構
- Hadoop單機版安裝Hadoop
- centos7安裝HadoopCentOSHadoop
- hadoop安裝中錯誤Hadoop
- Hadoop 安裝程式包下載Hadoop
- hadoop偽分散式安裝Hadoop分散式
- hadoop家族之mahout安裝Hadoop
- Hadoop之Pig安裝Hadoop
- Hadoop安裝配置:使用cloudreaHadoopCloud