Changes between Version 5 and Version 6 of waue/2009/nutch_install
- Timestamp:
- Apr 23, 2009, 7:16:31 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
waue/2009/nutch_install
v5 v6 19 19 || /opt/nutch_conf || nutch設定檔 || 20 20 || /opt/hadoop || hadoop家目錄 || 21 || / etc/hadoop/conf || hadoop設定檔 ||21 || /opt/hadoop/conf || hadoop設定檔 || 22 22 23 23 … … 26 26 可以用實做一的方法來安裝,然而為了簡化Hadoop安裝,用最簡方式實做 27 27 {{{ 28 ~$ sudo su -29 ~ # echo "deb http://free.nchc.org.tw/debian lenny non-free" > /etc/apt/sources.list.d/lenny-nonfree.list30 ~ # echo "deb http://www.classcloud.org unstable main" > /etc/apt/sources.list.d/hadoop.list31 ~ # apt-get update32 ~ # apt-get installhadoop33 (略 .. 確認 java 授權選項 .. ) 34 ~ # chown -R hadooper /opt/hadoop28 ~$ cd /opt/hadoop.nchc.org.tw/~waue/hadoop_nchc.tar.gz 29 ~$ wget http://hadoop.nchc.org.tw/~waue/hadoop_nchc.tar.gz 30 ~$ tar -zxvf hadoop_nchc.tar.gz 31 ~$ chown -R hadooper hadoop 32 ~$ cd /opt/hadoop 33 ~$ bin/hadoop namenode -format 34 ~$ bin/start-all 35 35 }}} 36 36 … … 47 47 == 2.2 部屬hadoop,nutch目錄結構 == 48 48 {{{ 49 $ mv nutch/conf ./nutch_conf50 $ cp -rf conf/* nutch_conf51 49 $ cp -rf hadoop/* nutch 52 }}} 53 * 做完以上動作,nutch的設定檔就會被放在/opt/nutch_conf下,並且把現有hadoop的設定(/opt/conf)帶進nutch的設定中,而nutch_home內的hadoop執行檔也會跟正在運行的hadoop同個版本。 54 * 以上的目錄結構在於nutch與hadoop分離,主程式與設定檔分離,(日誌檔則統一被紀錄到/tmp中),這樣的目的在於,要刪除nutch的話直接移除目錄就好,不會動到原本的hadoop。 50 $ cd nutch 51 }}} 55 52 56 53 = step 3 編輯設定檔 = 57 * 所有的設定檔都在 /opt/nutch _conf 下54 * 所有的設定檔都在 /opt/nutch/conf 下 58 55 == 3.1 hadoop-env.sh == 59 56 * 將原本的檔案hadoop-env.sh任意處填入 … … 67 64 export HADOOP_PID_DIR=/tmp/hadoop/pid 68 65 export NUTCH_HOME=/opt/nutch 69 export NUTCH_CONF_DIR=/opt/nutch _conf66 export NUTCH_CONF_DIR=/opt/nutch/conf 70 67 }}} 71 68 * 載入環境設定值 72 69 {{{ 73 $ source /opt/nutch _conf/hadoop-env.sh70 $ source /opt/nutch/conf/hadoop-env.sh 74 71 }}} 75 72 * ps:強烈建議寫入 /etc/bash.bashrc 中比較萬無一失!! 76 73 77 == 3.2 hadoop-site.xml == 78 {{{ 79 #!sh 80 <configuration> 81 <property> 82 <name>fs.default.name</name> 83 <value>hdfs://node1:9000/</value> 84 <description> </description> 85 </property> 86 <property> 87 <name>mapred.job.tracker</name> 88 <value>node1:9001</value> 89 <description> </description> 90 </property> 91 <property> 92 <name>hadoop.tmp.dir</name> 93 <value>/tmp/hadoop/hadoop-${user.name}</value> 94 <description> </description> 95 </property> 96 </configuration> 97 }}} 98 == 3.3 nutch-site.xml == 74 75 == 3.3 conf/nutch-site.xml == 99 76 * 重要的設定檔,新增了必要的內容於內,然而想要瞭解更多參數資訊,請見nutch-default.xml 77 {{{ 78 $ vim conf/nutch-site.xml 79 }}} 100 80 {{{ 101 81 #!sh … … 113 93 <property> 114 94 <name>http.agent.url</name> 115 <value> node1</value>95 <value>localhost</value> 116 96 <description>A URL to advertise in the User-Agent header. </description> 117 97 </property> … … 160 140 </configuration> 161 141 }}} 162 == 3.4 slaves == 163 164 * 這個檔不用設定,因為依照hadoop的叢集環境,下面列出我們環境所設定的 165 {{{ 166 #!sh 167 node1 168 node2 169 }}} 142 170 143 == 3.5 crawl-urlfilter.txt == 171 144 * 重新編輯爬檔規則,此檔重要在於若設定不好,則爬出來的結果幾乎是空的,也就是說最後你的搜尋引擎都找不到資料啦! 145 {{{ 146 $ vim conf/crawl-urlfilter.txt 147 }}} 172 148 {{{ 173 149 #!sh … … 182 158 }}} 183 159 184 == 3.6 regex-urlfilter.txt == 185 * 雖然官方網站鮮少介紹到此檔,但是crawl-urlfilter.txt用來設定爬intranet的規則,而regex-urlfilter.txt則是用來設定爬internet的規則 186 187 {{{ 188 $ cd /opt/nutch_conf 189 $ cp regex-urlfilter.txt regex-urlfilter.txt-bek 190 $ cp crawl-urlfilter.txt regex-urlfilter.txt 191 }}} 160 192 161 193 162 = step 4 執行nutch = 194 163 195 * 在此假設你已經把hadoop 啟動並且正在運作了。因此nutch是利用這個已經在運做的平台上196 * 如果你的hadoop還沒啟動,則請在master節點(此篇以node1當作master)下 bin/start-all.sh指令;如果你的環境很clean,則請在master節點下197 * 到/opt/nutch 或 /opt/hadoop皆可198 {{{199 $ cd /opt/nutch200 $ bin/hadoop namenode -format201 $ bin/start-all.sh202 }}}203 204 164 == 4.1 編輯url清單 == 205 165 {{{ 206 166 $ mkdir urls 207 $ vim urls.txt 208 }}} 209 210 {{{ 211 #!sh 212 http://www.nchc.org.tw 167 $ echo "http://www.nchc.org.tw" >> ./urls/urls.txt 213 168 }}} 214 169 215 170 == 4.2 上傳清單到HDFS == 216 171 {{{ 217 $ bin/hadoop -put urls urls172 $ bin/hadoop dfs -put urls urls 218 173 }}} 219 174 == 4.3 執行nutch crawl ==