Changes between Version 4 and Version 5 of waue/2009/0409


Ignore:
Timestamp:
Apr 9, 2009, 6:31:49 PM (15 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2009/0409

    v4 v5  
    2323
    2424 *
    25 == step 1 安裝好Hadoop叢集 ==
     25= step 1 安裝好Hadoop叢集 =
    2626
    2727 * 可以參考這篇 [wiki:0330Hadoop_Lab3 hadoop叢集安裝]
     
    2929 * 安裝好hadoop 叢集之後,/opt/的權限就是使用者的了,並且ssh登入兩台都免密碼,hadoop也能正常執行,並且安裝於/opt/hadoop下,設定檔在 /opt/conf
    3030
    31 == step 2 下載與安裝 ==
    32 
    33  === 2.1 下載 nutch 並解壓縮 ===
     31= step 2 下載與安裝 =
     32
     33 == 2.1 下載 nutch 並解壓縮 ==
    3434 *  nutch 1.0 (2009/03/28 release )
    3535{{{
     
    3939$ mv nutch-1.0.tar.gz nutch
    4040}}}
    41  === 2.2 部屬hadoop,nutch目錄結構 ===
     41 == 2.2 部屬hadoop,nutch目錄結構 ==
    4242{{{
    4343$ mv nutch/conf ./nutch_conf
     
    4848 * 以上的目錄結構在於nutch與hadoop分離,主程式與設定檔分離,(日誌檔則統一被紀錄到/tmp中),這樣的目的在於,要刪除nutch的話直接移除目錄就好,不會動到原本的hadoop。
    4949
    50 == step 3 編輯設定檔 ==
     50= step 3 編輯設定檔 =
    5151 * 所有的設定檔都在 /opt/nutch_conf 下
    52 === 3.1 hadoop-env.sh ===
     52== 3.1 hadoop-env.sh ==
    5353 * 將原本的檔案hadoop-env.sh任意處填入
    5454{{{
     
    6969 * ps:強烈建議寫入 /etc/bash.bashrc 中比較萬無一失!!
    7070
    71 === 3.2 hadoop-site.xml ===
     71== 3.2 hadoop-site.xml ==
    7272{{{
    7373#!sh
    7474<configuration>
    75 
    7675  <property>
    77 
    7876    <name>fs.default.name</name>
    79 
    8077    <value>hdfs://node1:9000/</value>
    81 
    8278    <description> </description>
    83 
    8479  </property>
    85 
    8680  <property>
    87 
    8881    <name>mapred.job.tracker</name>
    89 
    9082    <value>node1:9001</value>
    91 
    9283    <description>  </description>
    93 
    9484  </property>
    95 
    9685  <property>
    97 
    9886    <name>hadoop.tmp.dir</name>
    99 
    10087    <value>/tmp/hadoop/hadoop-${user.name}</value>
    101 
    10288    <description> </description>
    103 
    10489  </property>
    105 
    10690</configuration>
    10791}}}
    108 === 3.3 nutch-site.xml ===
    109  * 重要的設定檔,新增了必要的內容於內,然而想要解更多參數資訊,請見nutch-default.xml
     92== 3.3 nutch-site.xml ==
     93 * 重要的設定檔,新增了必要的內容於內,然而想要解更多參數資訊,請見nutch-default.xml
    11094{{{
    11195#!sh
     
    133117</property>
    134118<property>
    135 
    136119  <name>plugin.folders</name>
    137 
    138120  <value>/opt/nutch/plugins</value>
    139 
    140121  <description>Directories where nutch plugins are located. </description>
    141 
    142 </property>
    143 
    144 <property>
    145 
     122</property>
     123<property>
    146124  <name>plugin.includes</name>
    147 
    148125  <value>protocol-(http|httpclient)|urlfilter-regex|parse-(text|html|js|ext|msexcel|mspowerpoint|msword|oo|pdf|rss|swf|zip)|index-(more|basic|anchor)|query-(more|basic|site|url)|response-(json|xml)|summary-basic|scoring-opic|urlnormalizer-(pass|regex|basic)</value>
    149 
    150126  <description> Regular expression naming plugin directory names</description>
    151 
    152  </property>
    153 
     127 </property>
    154128 <property>
    155 
    156129  <name>parse.plugin.file</name>
    157 
    158130  <value>parse-plugins.xml</value>
    159 
    160131  <description>The name of the file that defines the associations between
    161 
    162132  content-types and parsers.</description>
    163 
    164  </property>
    165 
     133 </property>
    166134 <property>
    167 
    168135   <name>db.max.outlinks.per.page</name>
    169 
    170136   <value>-1</value>
    171 
    172137   <description> </description>
    173 
    174  </property>
    175 
     138 </property>
    176139 <property>
    177 
    178140   <name>http.content.limit</name>
    179 
    180141   <value>-1</value>
    181 
    182  </property>
    183 
    184 <property>
    185 
    186 <property>
    187 
     142 </property>
     143<property>
     144<property>
    188145  <name>indexer.mergeFactor</name>
    189 
    190146  <value>500</value>
    191 
    192   <description>The factor that determines the frequency of Lucene segment
    193 
    194   merges. </description>
    195 
    196 </property>
    197 
    198 
    199 <property>
    200 
     147  <description>The factor that determines the frequency of Lucene segment merges. </description>
     148</property>
     149<property>
    201150  <name>indexer.minMergeDocs</name>
    202 
    203151  <value>500</value>
    204 
    205152  <description>This number determines the minimum number of Lucene. </description>
    206 
    207 </property>
    208 
     153</property>
    209154</configuration>
    210155}}}
    211 === 3.4 slaves ===
     156== 3.4 slaves ==
    212157
    213158 * 這個檔不用設定,因為依照hadoop的叢集環境,下面列出我們環境所設定的
     
    217162node2
    218163}}}
    219 === 3.5 crawl-urlfilter.txt ===
     164== 3.5 crawl-urlfilter.txt ==
    220165 * 重新編輯爬檔規則,此檔重要在於若設定不好,則爬出來的結果幾乎是空的,也就是說最後你的搜尋引擎都找不到資料啦!
    221166{{{
     
    231176}}}
    232177
    233 === 3.6 regex-urlfilter.txt ===
     178== 3.6 regex-urlfilter.txt ==
    234179 * 雖然官方網站鮮少介紹到此檔,但是crawl-urlfilter.txt用來設定爬intranet的規則,而regex-urlfilter.txt則是用來設定爬internet的規則
    235180
     
    240185}}}
    241186
    242 == step 4 執行nutch ==
     187= step 4 執行nutch =
    243188
    244189 * 在此假設你已經把hadoop 啟動並且正在運作了。因此nutch是利用這個已經在運做的平台上
     
    251196}}}
    252197
    253 === 4.1 編輯url清單 ===
     198== 4.1 編輯url清單 ==
    254199{{{
    255200$ mkdir urls
     
    262207}}}
    263208
    264 === 4.2 上傳清單到HDFS ===
     209== 4.2 上傳清單到HDFS ==
    265210{{{
    266211$ bin/hadoop -put urls urls
    267212}}}
    268 === 4.3 執行nutch crawl ===
     213== 4.3 執行nutch crawl ==
    269214 * 用下面的指令就可以命令nutch開始工作了,之後map reduce會瘋狂工作
    270215{{{
     
    277222 * 在nutch運作的同時,可以在node1節點用瀏覽器,透過 [http://localhost:50030 job管理頁面],[http://localhost:50070 hdfs管理頁面],[http://localhost:50060 程序運作頁面] 來監看程序。
    278223
    279 == step 5 瀏覽搜尋結果 ==
     224= step 5 瀏覽搜尋結果 =
    280225 * nutch 在 step 4 的工作是把你寫在urls.txt檔內的網址,用map reduce的程序來進行資料分析,但是分析完之後,要透過tomcat來觀看結果。以下就是安裝與設定你的客製化搜尋引擎的步驟。
    281226
    282 === 5.1 安裝tomcat ===
     227== 5.1 安裝tomcat ==
    283228 * 下載tomcat
    284229{{{
     
    293238}}}
    294239
    295 === 5.1 tomcat server設定 ===
     240== 5.1 tomcat server設定 ==
    296241
    297242 * 修改 /opt/tomcat/conf/server.xml 以修正中文亂碼問題
     
    303248               useBodyEncodingForURI="true" />
    304249}}}
    305 === 5.3 下載crawl結果===
     250== 5.3 下載crawl結果 ==
    306251
    307252 * 先把放在hdfs上,nutch的運算結果下載到local端
     
    311256}}}
    312257
    313 === 5.4 設定nutch的搜尋引擎頁面到tomcat ===
     258== 5.4 設定nutch的搜尋引擎頁面到tomcat ==
    314259
    315260 * 把nutch的搜尋引擎頁面取代為tomcat的webapps/ROOT
     
    324269$ mv /opt/nutch/web /opt/tomcat/webapps/ROOT
    325270}}}
    326 === 5.5  設定搜尋引擎內容的來源路徑 ===
     271== 5.5  設定搜尋引擎內容的來源路徑 ==
    327272 * 5.4的步驟雖然設定好搜尋引擎的頁面,然而其只能當作是介面而已,因此這個步驟把要搜尋的內容與搜尋介面做個連結
    328273{{{
     
    340285}}}
    341286
    342 === 5.6 啟動tomcat ===
     287== 5.6 啟動tomcat ==
    343288{{{
    344289$ /opt/tomcat/bin/startup.sh
    345290}}}
    346291
    347 == step 6 享受結果 ==
     292= step 6 享受結果 =
    348293
    349294Enjoy ! [http://localhost:8080]