豆掰娱乐
您的当前位置:首页Nutch2.1+mysql+solr3.6.1+中文网站抓取

Nutch2.1+mysql+solr3.6.1+中文网站抓取

来源:豆掰娱乐
 E、使用ant编译 ${APACHE_NUTCH_HOME} 。


F、设置待抓取的网站

cd ${APACHE_NUTCH_HOME}/runtime/local
mkdir -p urls
echo 'http://nutch.apache.org/' > urls/seed.txt

G、执行爬行操作: bin/nutch crawl urls -depth 3 -topN 5

执行完在mysql中即可以查看到爬虫抓取的内容


3、安装solr,对nutch抓取的内容进行索引

(注意:参考资料中推荐使用solr4.0版本,4.0的两个版本我都试了,没有成功,所以替换为3.6.1版本)

solr下载地址:http://www.fayea.com/apache-mirror/lucene/solr/3.6.1/apache-solr-3.6.1.zip


A、解压缩下载包,

B、下载 http://nlp.solutions.asia/wp-content/uploads/2012/08/schema.xml替换${APACHE_SOLR_HOME}/example/solr/conf/schema.xml.

C、启动solr

cd ${APACHE_SOLR_HOME}/example

java -jar start.jar

D、在浏览器输入地址http://localhost:83/solr 测试是否启动成功。

E、另起linux终端,输入如下命令,使solr对nutch抓取内容进行索引。

cd ${APACHE_NUTCH_HOME}/runtime/local/

bin/nutch solrindex http://127.0.0.1:83/solr/ -reindex

4、测试

在浏览器输入 http://localhost:83/solr ,看到如下界面:



在文本框中输入 content:nutch 点击查询,便可查处内容中包含nutch关键字的网页

显示全文