Changes between Version 5 and Version 6 of waue/2009/nutch_install


Ignore:
Timestamp:
Apr 23, 2009, 7:16:31 PM (15 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2009/nutch_install

    v5 v6  
    1919|| /opt/nutch_conf || nutch設定檔 ||
    2020|| /opt/hadoop || hadoop家目錄 ||
    21 || /etc/hadoop/conf || hadoop設定檔 ||
     21|| /opt/hadoop/conf || hadoop設定檔 ||
    2222
    2323
     
    2626可以用實做一的方法來安裝,然而為了簡化Hadoop安裝,用最簡方式實做
    2727{{{
    28 ~$ sudo su -
    29 ~# echo "deb http://free.nchc.org.tw/debian lenny non-free" > /etc/apt/sources.list.d/lenny-nonfree.list
    30 ~# echo "deb http://www.classcloud.org unstable main" > /etc/apt/sources.list.d/hadoop.list
    31 ~# apt-get update
    32 ~# apt-get install hadoop
    33 (略 .. 確認 java 授權選項 .. )
    34 ~# chown -R hadooper /opt/hadoop
     28~$ 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
    3535}}}
    3636
     
    4747 == 2.2 部屬hadoop,nutch目錄結構 ==
    4848{{{
    49 $ mv nutch/conf ./nutch_conf
    50 $ cp -rf conf/* nutch_conf
    5149$ 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}}}
    5552
    5653= step 3 編輯設定檔 =
    57  * 所有的設定檔都在 /opt/nutch_conf 下
     54 * 所有的設定檔都在 /opt/nutch/conf 下
    5855== 3.1 hadoop-env.sh ==
    5956 * 將原本的檔案hadoop-env.sh任意處填入
     
    6764export HADOOP_PID_DIR=/tmp/hadoop/pid
    6865export NUTCH_HOME=/opt/nutch
    69 export NUTCH_CONF_DIR=/opt/nutch_conf
     66export NUTCH_CONF_DIR=/opt/nutch/conf
    7067}}}
    7168 * 載入環境設定值
    7269{{{
    73 $ source /opt/nutch_conf/hadoop-env.sh
     70$ source /opt/nutch/conf/hadoop-env.sh
    7471}}}
    7572 * ps:強烈建議寫入 /etc/bash.bashrc 中比較萬無一失!!
    7673
    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 ==
    9976 * 重要的設定檔,新增了必要的內容於內,然而想要瞭解更多參數資訊,請見nutch-default.xml
     77{{{
     78$ vim conf/nutch-site.xml
     79}}}
    10080{{{
    10181#!sh
     
    11393<property>
    11494  <name>http.agent.url</name>
    115   <value>node1</value>
     95  <value>localhost</value>
    11696  <description>A URL to advertise in the User-Agent header. </description>
    11797</property>
     
    160140</configuration>
    161141}}}
    162 == 3.4 slaves ==
    163 
    164  * 這個檔不用設定,因為依照hadoop的叢集環境,下面列出我們環境所設定的
    165 {{{
    166 #!sh
    167 node1
    168 node2
    169 }}}
     142
    170143== 3.5 crawl-urlfilter.txt ==
    171144 * 重新編輯爬檔規則,此檔重要在於若設定不好,則爬出來的結果幾乎是空的,也就是說最後你的搜尋引擎都找不到資料啦!
     145{{{
     146$ vim conf/crawl-urlfilter.txt
     147}}}
    172148{{{
    173149#!sh
     
    182158}}}
    183159
    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
    192161
    193162= step 4 執行nutch =
    194163
    195  * 在此假設你已經把hadoop 啟動並且正在運作了。因此nutch是利用這個已經在運做的平台上
    196  * 如果你的hadoop還沒啟動,則請在master節點(此篇以node1當作master)下 bin/start-all.sh指令;如果你的環境很clean,則請在master節點下
    197    * 到/opt/nutch 或 /opt/hadoop皆可
    198 {{{
    199 $ cd /opt/nutch
    200 $ bin/hadoop namenode -format
    201 $ bin/start-all.sh
    202 }}}
    203 
    204164== 4.1 編輯url清單 ==
    205165{{{
    206166$ 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
    213168}}}
    214169
    215170== 4.2 上傳清單到HDFS ==
    216171{{{
    217 $ bin/hadoop -put urls urls
     172$ bin/hadoop dfs -put urls urls
    218173}}}
    219174== 4.3 執行nutch crawl ==