Ruby on Rails - Solr/Sunspot:连接被拒绝 - 连接(2)
我几乎正在尝试部署一个使用 Sunspot 的 Rails 应用程序。我关注了 https://github。 com/outoftime/sunspot/wiki/Configure-Solr-on-Ubuntu,-the-quickest-way,但是在运行应用程序时,我得到以下信息:
连接被拒绝 - 连接(2)
这表明它无法正确访问服务器,我已经在谷歌上搜索并尝试了几个小时,但无济于事。
有什么想法吗?
Pretty much I'm trying to deploy a Rails application that uses Sunspot. I've followed https://github.com/outoftime/sunspot/wiki/Configure-Solr-on-Ubuntu,-the-quickest-way, but when running the application I get the following:
Connection refused - connect(2)
This indicates that it can't access the server properly, and I've been googling and trying things for hours, but to no avail.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以尝试重新索引
如果这不起作用,您可以...
...启动 solr
...然后再次重新索引
You can try reindexing
If that doesn't work, you can...
...start solr
...and reindex again
事实证明,最终,在完成所有故障排除之后,问题只是配置文件中的端口号(以某种冗长的方式)——即 Sunspot.config.solr。网址。
It turns out that in the end, after all the troubleshooting, the problem was just the port number in the config file (in some drawn out way) -- i.e.
Sunspot.config.solr.url
.$rake sunspot:solr:start RAILS_ENV=production$
使用 Rails 设置 sunspot solr在生产环境表明,确实就是这么简单。
您能具体说明您在尝试此操作时遇到的问题吗?或者是什么原因导致你没有尝试呢?因为安装 solr/tomcat/etc 比输入一行代码要多得多的工作。
您也可能会幸运地使用 http://internetmodulation。 com/2011/01/10/sunspot-solr-tomcat-ubunut.html.html(如果您决定安装完整的 tomcat/solr)。
$rake sunspot:solr:start RAILS_ENV=production$
Setup sunspot solr with rails in production environment indicates that it is, indeed, as simple as this.
can you be specific as to the problem(s) you had when you tried this? or what caused you to not try it? because installing solr/tomcat/etc is a lot more work than typing that one line of code.
you may also have luck with http://internetmodulation.com/2011/01/10/sunspot-solr-tomcat-ubunut.html.html if you decide to have a full tomcat/solr install.
这篇博客可能会解决您的问题:
在 CentOS 中使用 Jetty 安装 Solr 4.4,并设置 Solr 服务器以与 Sunspot Gem 配合使用。 ( http://blogs.pigrider.com/blogs/26 )
以下是来自博客:
......
8) 将此配置文件 schema.yml 从 Rails 应用程序复制到正在运行的 Solr 4.4 实例的主目录。它将覆盖那里的 Solr 示例配置文件,并将设置 Solr 4.4 服务器以与 Sunspot Gem 一起使用。
cp /RailsApplicationPath/Solr/conf/schema.yml /opt/solr/solr/collection1/conf/。
正在运行的 Solr 4.4 实例的主目录是 /opt/solr/solr/collection1/。您可以从 Solr 管理页面 http:// localhost :8983/solr/admin 找到此信息
9) 将 version 字段添加到配置文件 schema.yml 以满足 Solr 4.4 初始化要求。实际上,需要在文件中添加两行代码。它们是:
配置文件 schema.yml 最终会是这样的:
……
This blog may solve your question:
Install Solr 4.4 with Jetty in CentOS, and set up Solr server to work with Sunspot Gem. ( http://blogs.pigrider.com/blogs/26 )
Below are some parts from the blog:
......
8) Copy this configuration file schema.yml from your Rails application to the home directory of the running Solr 4.4 instance. It will overrider the Solr example configuration file there, and it will set up Solr 4.4 server to work with Sunspot Gem.
cp /RailsApplicationPath/Solr/conf/schema.yml /opt/solr/solr/collection1/conf/.
The home directory of the running Solr 4.4 instance is /opt/solr/solr/collection1/. You can find this information from Solr admin page http:// l o c a l h o s t :8983/solr/admin
9) Add version field into the configuration file schema.yml to satisfy Solr 4.4 initialization requirement. Actually, two lines of code need to be added into the file. They are:
The configuration file schema.yml eventually will look like:
......