tho*_*mey 2 ubuntu solr tomcat7
我试图在Ubuntu 12.04服务器上运行Tomcat 7下的Solr 4.8,这将使用sunspot_rails
gem 从Rails 4应用程序访问.
目前我只是使用Solr 4.8中的多核示例进行测试,以验证它是否使用默认配置.
Tomcat正常运行(curl localhost:8080
返回"It is working"页面),我在Tomcat或Solr日志中看不到任何错误.但curl localhost:8080/solr
不返回任何东西,并curl localhost:8080/solr/update
返回The requested resource (/solr/update) is not available.
.(我在localhost上使用curl,因为我无法远程访问Tomcat 7管理员或Solr管理员).
我已经将solr.war
示例中的文件复制到多核,并将所有jar文件和log4j.properties复制到tomcat7/lib中(基本上只是按照这里的说明进行操作,但当然是4.8版本http://gagannaidu.blogspot.no/2014/ 02/apache-solr-461-tomcat7-setup-on-ubuntu.html):
sudo cp /usr/share/solr/example/webapps/solr.war /usr/share/solr/example/multicore/solr.war
sudo cp -r solr/example/lib/ext/* /usr/share/tomcat7/lib
sudo cp -r solr/example/resources/log4j.properties /usr/share/tomcat7/lib
Run Code Online (Sandbox Code Playgroud)
我还将多核文件夹的所有者设置为tomcat7:
sudo chown -R tomcat7 /usr/share/solr/example/multicore
Run Code Online (Sandbox Code Playgroud)
这是我的配置文件:
solr.xml在/ var/lib中/ tomcat7/conf目录/卡塔利娜/本地主机:
<Context docBase="/usr/share/solr/example/multicore/solr.war" debug="0" privileged="true" allowLinking="true" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/usr/share/solr/example/multicore" override="true" />
</Context>
Run Code Online (Sandbox Code Playgroud)
/ usr/share/solr/example/multicore中的solr.xml:
<solr persistent="false">
<cores adminPath="/admin/cores" host="${host:}" hostPort="${jetty.port:8983}" hostContext="${hostContext:solr}">
<core name="core0" instanceDir="core0" />
<core name="core1" instanceDir="core1" />
<shardHandlerFactory name="shardHandlerFactory" class="HttpShardHandlerFactory">
<str name="urlScheme">${urlScheme:}</str>
</shardHandlerFactory>
</cores>
</solr>
Run Code Online (Sandbox Code Playgroud)
我已经尝试将hostPort更改为"${jetty.port:8080}"
或只是"8080"
但这似乎没有帮助.
任何人都知道我能做些什么来让这个工作?
好的,终于让它在这里工作了.
这是我做的:
1)我再次下载Solr 4.8,解压并移动到/usr/share/solr
.
2)我将solr.war复制到solr示例而不是多核示例中:
sudo cp /usr/share/solr/example/webapps/solr.war /usr/share/solr/example/solr/solr.war
Run Code Online (Sandbox Code Playgroud)
3)然后我复制了jar和日志文件:
sudo cp -r solr/example/lib/ext/* /usr/share/tomcat7/lib
sudo cp -r solr/example/resources/log4j.properties /usr/share/tomcat7/lib
Run Code Online (Sandbox Code Playgroud)
4)我将/usr/share/tomcat7/lib/log4j.properties中的日志路径设置为(然后创建文件):
solr.log=/usr/share/solr
touch solr.log
Run Code Online (Sandbox Code Playgroud)
(在/ usr/share/solr /内)
5)我把以下内容solr.xml
放入/var/lib/tomcat7/conf/Catalina/localhost
:
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/usr/share/solr/example/solr/solr.war" debug="0" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/usr/share/solr/example/solr" override="true" />
</Context>
Run Code Online (Sandbox Code Playgroud)
6)我在/usr/share/solr/example/solr/solr.xml中将hostPort更改为8080:
<int name="hostPort">8080</int>
Run Code Online (Sandbox Code Playgroud)
7)最后我将用户**tomcat7设置为/ usr/share/solr文件夹的所有者:
sudo chown -R tomcat7 /usr/share/solr
Run Code Online (Sandbox Code Playgroud)
这可能会被清理一下,从Solr发行版中删除不必要的文件和示例,但至少它让我开始运行.
对于那些想要与sunspot_rails gem一起使用的人,那么你需要用Rails项目中的schema.xml
文件替换里面的文件/usr/share/solr/example/solr/collection1/conf
,并为你的sunspot.yml
文件做这样的事情:
production:
solr:
hostname: localhost
port: 8080
log_level: WARNING
path: /solr
Run Code Online (Sandbox Code Playgroud)
更新:
添加我的完整solr.xml文件以供参考:
<solr>
<solrcloud>
<str name="host">${host:}</str>
<int name="hostPort">8080</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>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2353 次 |
最近记录: |