- 安装的操作系统环境为:redhat6.5server64位系统,下载nutch1.8、solr4.7.0,解压压缩包并配置jdk支持
- 拷贝[solr_home]/dist/apache-solr-4.7.0.war的文件到tomcat/webapps目录下,并且改名solr.war
- 将[solr_home]\example\下的solr目录拷贝到任意位置,我是放在:~/tomcat7/solr下
- 在tomcat目录下的conf\Catalina\localhost目录中(如果没有则手工创建该目录)创建solr.xml文件,文件内容如下:
<Context docBase="[tomat_home]/webapps/solr.war" debug="0" crossContext="true" >
<Environment name="solr/home" type="java.lang.String" value="[tomcat_home]/solr" override="true" />
</Context>
tomcat/webapps/solr/WEB-INF/lib/下。这时可能会有重复的jar包,覆盖下就ok了.
启动tomcat,输入http://localhost:8080/solr/,出现欢迎界面则表示配置成功
6. 将[nutch_home]/conf/schema-solr4.xml复制到/tomcat7/solr/collection1/conf目录下并改名为schema.xml,并在<fields>节点最后
添加<field name="_version_" type="long" indexed="true" stored="true"/>,solr配置完成。
7. 配置nutch爬取网页:
(1)修改文件conf/nutch-site.xml,设置HTTP请求中agent的名字:
<?xml version="1.0"?>
(2)创建种子文件夹 :mkdir -p urls ,创建种子文件/urls/seed.txt,并添加要爬去的URL,如http://localhost:8080/<?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!-- Put site-specific property overrides in this file. --><configuration><property><name> http.agent.name </name><value>Friendly Crawler</value></property></configuration>
(3)配置conf/regex-urlfilter.txt文件,修改
# accept anything else
+.
为:+^http://([a-z0-9]*\.)*localhost:8080/
(4)执行爬取命令:./bin/crawl urls mydir http://localhost:8080/solr/ 2
(5)solr查询:
本文介绍了如何在RedHat 6.5环境下安装Nutch 1.8与Solr 4.7.0,并实现二者集成。具体步骤包括配置JDK、部署WAR包、调整配置文件等。此外还涉及了爬虫的配置与使用。
1万+

被折叠的 条评论
为什么被折叠?



