使用Solr在Centos上设置Nutch

时间:2017-05-29 20:20:37

标签: nutch

我尝试设置Apache Nutch和Apache Solr,以便我们的网站可以进行内部网站搜索。我已经按照我的指南进行了操作,虽然它们非常有用,但是如果发生错误并且大多数在这一点上看起来已经过时,它们将无法做什么。

我使用的是JDK 131,Nutch 2.3.1和Solr 6.5.1

这是来自无根用户的行为序列

sudo wget [java url] to /opt
sudo tar xvf java.tar.gz
export JAVA_HOME=/opt/java/
export JAVA_JRE=/opt/java/jre
export PATH=$PATH:/opt/java/bin:/opt/java/jre/bin
cd solr6.5.1/
sudo start runtime -e cloud -noprompt

sudo wget [solr url] to /root
sudo tar xvf solr.tar.gz


sudo wget [nutch url] to /opt
sudo tar xvf nutch.tar.gz
cd /opt/apache-nutch-2.3.1
sudo vi nutch-site.xml

添加:

<configuration>
<property>
  <name>http.agent.name</name>
  <value>nutch-solr-integration</value>
</property>

<property>
  <name>generate.max.per.host</name>
  <value>100</value>
</property>

<property>
  <name>plugin.includes</name>
  <value>protocol-http|urlfilter-regex|parse-(html|tika|metatags)|index-(basic|anchor|metadata)|query-(basic|site|url)|response-(json|xml)|summary-basic|scoring-opic|indexer-solr|urlnormalizer-(pass|regex|basic)</value>
  <description> At the very least, I needed to add the parse-html, urlfilter-regex, and the indexer-solr.
  </description>
</property>

<property>
  <name>storage.data.store.class</name>
  <value>org.apache.gora.sql.store.SqlStore</value>
  <description>The Gora DataStore class for storing and retrieving data.</description>
</property>
</configuration>

cd /opt/apache-nutch-2.3.1
mkdir urls
cd urls
sudo vi seed.txt
  add [our site url]
[ESC]
:w
:q
cd ../conf
sudo vi regex-urlfilter.xml
add:
+^http://([a-zA-Z0-9]*\.)*[domain of our site].com/
[ESC]
:w
:q
cd ..
sudo ant runtime
sudo -E runtime/local/bin/nutch inject urls -crawlId 3

然后我明白了:

InjectorJob: Injecting urlDir: urls
InjectorJob: java.lang.ClassNotFoundException: org.apache.gora.sql.store.SqlStore
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.nutch.storage.StorageUtils.getDataStoreClass(StorageUtils.java:93)
    at org.apache.nutch.storage.StorageUtils.createWebStore(StorageUtils.java:77)
    at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:218)
    at org.apache.nutch.crawl.InjectorJob.inject(InjectorJob.java:252)
    at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:275)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.nutch.crawl.InjectorJob.main(InjectorJob.java:284)

我的问题是我为什么会收到此错误以及如何解决此问题。我在很多地方看到修改了schema.xml的solr目录,但solr目录中没有schema.xml文件。

1 个答案:

答案 0 :(得分:0)

当您使用sql-store作为Nutch后端时,您是否编辑了ivy/ivy.xml并取消注释此行?

<dependency org="org.apache.gora" name="gora-sql" rev="0.1.1-incubating" conf="*->default" />

如果没有,请取消注释此行并清除&amp;再建一次。如果它仍然不起作用,请告诉我您的完整方法或您遵循的教程。

修改

正如你所说,你使用hbase作为商店,你的nutch-site.xml属性应该是这个 -

<property>
    <name>storage.data.store.class</name>
    <value>org.apache.gora.hbase.store.HBaseStore</value>
</property>

请仔细阅读您提到的链接。