我已经使用以下配置安装了tomcat 7和solr 4.7:
服务器配置: /opt/tom-solr/conf/server.xml
<Service name="solr">
<Connector port="8082" protocol="HTTP/1.1"
connectionTimeout="20000"
URIEncoding="UTF-8" redirectPort="8443" />
<Engine name="solr-live" defaultHost="solr-live">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="solr-live" appBase="/opt/tom-solr/webapps/solr/"
unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="access-" suffix=".txt"
pattern="common" />
<Context path="" docBase="/opt/tom-solr/webapps/solr/solr.war" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/home/--------------/cwasolr/app" override="true"/>
</Context>
<Context path="/manager" docBase="/opt/tom-solr/webapps/manager"
antiResourceLocking="false" privileged="true" />
</Host>
</Engine>
</Service>
我已将solr.war文件添加到: /opt/tom-solr/webapps/solr/solr.war
在App文件夹中: / home / rishi / -------- / cwasolr / app
有以下文件:
4 drwxrwxr-x 4 rishi rishi 4096 May 12 20:22 celebrity
4 -rw-r--r-- 1 rishi rishi 1715 Feb 18 16:18 solr.xml
./celebrity:
total 8
4 drwxrwxr-x 3 rishi rishi 4096 May 11 00:46 conf
4 -rw-rw-r-- 1 rishi rishi 16 May 9 23:55 core.properties
./celebrity/conf:
total 28
8 -rwxrwxrwx 1 rishi rishi 5788 May 10 23:57 schema.xml
12 -rw-r--r-- 1 rishi rishi 10853 May 6 15:24 solrconfig.xml
4 -rwxrwxrwx 1 rishi rishi 347 Apr 26 18:35 stopwords.txt
4 -rwxrwxrwx 1 rishi rishi 1213 Apr 26 18:35 synonyms.txt
文件:------ / cwasolr / app / solr.xml
<solrcloud>
<str name="host">${host:}</str>
<int name="hostPort">${jetty.port:8983}</int>
<str name="hostContext">${hostContext:solr}</str>
<int name="zkClientTimeout">${zkClientTimeout:30000}</int>
<bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
</solrcloud>
<shardHandlerFactory name="shardHandlerFactory"
class="HttpShardHandlerFactory">
<int name="socketTimeout">${socketTimeout:0}</int>
<int name="connTimeout">${connTimeout:0}</int>
</shardHandlerFactory>
</solr>
但是当我从任何位置启动tomcat时,它开始从该位置搜索默认的collection1。我已经创建了一个核心名称名人,它的工作正常。但是收集错误1。
假设我在 / home / rishi / projects / 并启动tomcat,然后在错误日志中出现以下错误:
5/12/2014 8:29:36 PM ERROR CoreContainer Failed to load file /home/rishi/projects/solr/collection1/solrconfig.xml
5/12/2014 8:29:36 PM ERROR CoreContainer Unable to create core: collection1
5/12/2014 8:29:36 PM ERROR CoreContainer null:org.apache.solr.common.SolrException: Unable to create core: collection1
org.apache.solr.common.SolrException: Could not load config file /home/rishi/projects/solr/collection1/solrconfig.xml
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:530)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:597)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:258)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:250)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Can't find resource 'solrconfig.xml' in classpath or '/home/rishi/projects/solr/collection1/conf'
at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:342)
at org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:288)
at org.apache.solr.core.Config.<init>(Config.java:116)
at org.apache.solr.core.Config.<init>(Config.java:86)
at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:140)
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:527)
... 9 more