基於hadoop+nutch+solr的搜索引擎環境搭載<三>hadoop,nutch,solr整合到eclipse上開發


     版本:

       eclipse: 

  eclipse-jee-juno-SR2-linux-gtk

  tomcat7:

      apache-tomcat-7.0.39

一,下載安裝eclipse,tomcat

       下載安裝eclipse后,解壓,運行eclipse

       在菜單欄里

       window->preferences->server->runtime environment    

       add tomcat7 

二,集成hadoop。

   hadoop之前的版本有集成好的eclipse插件,現在需要自己編譯,具體步驟可以百度。

        這里是我用的插件 

        將hadoop-eclipse-plugin-1.0.4放在/eclipse/plugins下(如果是用軟件中心安裝的話是/usr/share/eclipse/plugins/)

         重啟eclipse,然后可以看到在project Explorer中看到DFS locations

           window->show view->other->Map/Reduce Locations 確認后配置Hadoop installation directory即可

                 

     點“藍色大象“新建

修改參數

此處Map/Reduce Master與mapred-site.xml對應

     DFS   Master與hadoop/conf/core-site.xml中對應

  重啟eclipse,點開DFS location就可以看到hdfs(記得啟動hadoop)

 

 三,nutch,solr集成在hadoop上

   nutch是一個應用程序,在我的這個項目里主要是做爬蟲用,爬取后的內容存放在hdfs上,所以在hdfs整合模塊已經整合上去了。

   solr:

    在eclipse新建動態網頁項目,刪除WebContent的所有內容。

 在solr/dist下(或者/solr3.6.2/example/webapps下)解壓solr.war  將所有內容拷貝到WenContent里。

    修改WEB-INF里的web.xml

    添加

<env-entry>
        <env-entry-name>solr/home</env-entry-name>
        <env-entry-value>/home/hadoop/solr3.6.2/example/solr</env-entry-value>
        <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

  到最后的</web-app>前。

 解釋下這個地方是你的solr core的位置

 采用solr多核的話可以將

/home/hadoop/solr3.6.2/example/multicore,同時修改multicore中的solr.xml
<cores adminPath="/admin/cores">
    <core name="core0" instanceDir="/home/hadoop/solr3.6.2/example/multicore/core0" />
    <core name="core1" instanceDir="/home/hadoop/solr3.6.2/example/multicore/core1" />
  </cores>

 instanceDir為core的存放位置

在server中新建tomcat7服務,然后添加你剛新建的動態網頁工程

啟動tomcat7,在正常情況下,你可以選擇運行wencontent下的index.jsp 避免你弄錯url的路徑。

這樣,hadoop+nutch+solr的eclipse環境就搭建好了。

本系列文章也就結束了,這一兩個月的摸索與學習,收獲很多,比如MapReduce機制,信息檢索的一些知識。

當然后續還會繼續主要學習hadoop。

這應該是acm后第一個知識積累的階段。很好,繼續努力。

Sleeper_qp,Fighting!!!

夢想就在眼前了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM