王耀聰 陳威宇 Jazz@nchc.org.tw waue@nchc.org.tw 國家高速網路與計算中心(NCHC) 設置Hadoop環境 王耀聰 陳威宇 Jazz@nchc.org.tw waue@nchc.org.tw 國家高速網路與計算中心(NCHC)
Yahoo’s Hadoop Cluster ~10,000 machines running Hadoop in US The largest cluster is currently 2000 nodes Nearly 1 petabyte of user data (compressed, unreplicated) Running roughly 10,000 research jobs / week
Hadoop 單機設定與啟動 step 1. 設定登入免密碼 step 2. 安裝java step 3. 下載安裝Hadoop step 4.1 設定 hadoop-env.sh export JAVA_HOME=/usr/lib/jvm/java-6-sun step 4.2 設定 hadoop-site.xml 設定Namenode-> hdfs://localhost:9000 設定Jobtracker -> localhost:9001 step 5.1 格式化HDFS bin/hadoop namenode -format step 5.2 啟動Hadoop bin/start-all.sh step 6. 完成!檢查運作狀態 Job admin http://localhost:50030/ HDFS http://localhost:50070/
Hadoop 單機環境示意圖 Node 1 Localhost Namenode JobTracker Datanode conf / hadoop-site.xml: Localhost fs.default.name -> hdfs://localhost:9000 mapred.job.tracker -> localhost:9001 Namenode localhost:50070 JobTracker localhost:50030 conf/slaves: Datanode Tasktracker localhost
Hadoop 叢集設定與啟動 step 4.2 設定 hadoop-site.xml step 4.3 設定slaves 檔 step 2. 安裝java step 3. 下載安裝Hadoop step 4.1 設定 hadoop-env.sh export JAVA_HOME=/usr/lib/jvm/java-6-sun step 4.2 設定 hadoop-site.xml 設定Namenode-> hdfs://x.x.x.1:9000 設定Jobtracker -> x.x.x.2:9001 step 4.3 設定slaves 檔 step 4.4 將叢集內的電腦Hadoop都做一樣的配置 step 5.1 格式化HDFS bin/hadoop namenode -format step 5.2 啟動Hadoop nodeN執行: bin/start-dfs.sh ; nodeJ執行: bin/start-mapred.sh step 6. 完成!檢查運作狀態 Job admin http://x.x.x.2:50030/ HDFS http://x.x.x.1:50070/
情況一 Node 1 Node 2 x.x.x.1 Namenode JobTracker x.x.x.2 Datanode conf / hadoop-site.xml: x.x.x.1 http://x.x.x.1:50070 fs.default.name -> hdfs://x.x.x.1:9000 mapred.job.tracker -> x.x.x.1:9001 Namenode http://x.x.x.1:50030 JobTracker Node 2 x.x.x.2 conf/slaves: Datanode Tasktracker Datanode Tasktracker x.x.x.1 x.x.x.2 執行 namenode -format 與 start-all.sh
情況二 Node 1 Node 2 x.x.x.1 x.x.x.2 Namenode JobTracker Datanode conf / hadoop-site.xml: x.x.x.1 x.x.x.2 http://x.x.x.1:50070 fs.default.name -> hdfs://x.x.x.1:9000 mapred.job.tracker -> x.x.x.2:9001 Namenode JobTracker http://x.x.x.2:50030 conf/slaves: Datanode Tasktracker Datanode Tasktracker x.x.x.1 x.x.x.2 執行 namenode -format 與 start-dfs.sh 執行 start-mapred.sh
情況三 … Node 1 Node 2 Node N Namenode JobTracker x.x.x.2 x.x.x.n conf / hadoop.site.xml: Node 1 x.x.x.1 fs-default.name -> hdfs://x.x.x.1:9000 mapred.job.tracker -> x.x.x.1:9001 http://x.x.x.1:50070 Namenode JobTracker http://x.x.x.1:50030 Node 2 Node N conf/slaves: x.x.x.2 x.x.x.n x.x.x.2 ….. x.x.x.n Datanode Tasktracker Datanode Tasktracker …
情況四 conf / hadoop-site.xml: mapred.job.tracker-> x.x.x.2:9001 fs.default.name -> hdfs://x.x.x.1:9000 http://x.x.x.2:50030 http://x.x.x.1:50070 conf/slaves: x.x.x.3 ……. x.x.x.n