Ruby on Rails - Solr/Sunspot:连接被拒绝 - 连接(2)

发布于 2024-12-02 23:49:44 字数 380 浏览 0 评论 0原文

我几乎正在尝试部署一个使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

深海蓝天 2024-12-09 23:49:44

您可以尝试重新索引

$rake sunspot:solr:reindex RAILS_ENV=production

如果这不起作用,您可以...

$rm solr/pids/production/sunspot-solr-production.pid

...启动 solr

$rake sunspot:solr:start RAILS_ENV=production

...然后再次重新索引

$rake sunspot:solr:reindex RAILS_ENV=production

You can try reindexing

$rake sunspot:solr:reindex RAILS_ENV=production

If that doesn't work, you can...

$rm solr/pids/production/sunspot-solr-production.pid

...start solr

$rake sunspot:solr:start RAILS_ENV=production

...and reindex again

$rake sunspot:solr:reindex RAILS_ENV=production
眼睛会笑 2024-12-09 23:49:44

事实证明,最终,在完成所有故障排除之后,问题只是配置文件中的端口号(以某种冗长的方式)——即 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.

温馨耳语 2024-12-09 23:49:44

有人可以帮我让它工作吗?

$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)。

Could anyone help me get this working?

$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.

失与倦" 2024-12-09 23:49:44

这篇博客可能会解决您的问题:

在 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 初始化要求。实际上,需要在文件中添加两行代码。它们是:

<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>

<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>

配置文件 schema.yml 最终会是这样的:

<schema name="sunspot" version="1.0">
  <types>
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
    <!-- *** Other Sunspot fieldType Definitions *** -->
  </types>

  <fields>
    <field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
    <!-- *** Other Sunspot field Definitions *** -->
  </fields>

  <!-- *** Other Sunspot Configurations *** -->
</schema>

……

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:

<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>

<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>

The configuration file schema.yml eventually will look like:

<schema name="sunspot" version="1.0">
  <types>
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
    <!-- *** Other Sunspot fieldType Definitions *** -->
  </types>

  <fields>
    <field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
    <!-- *** Other Sunspot field Definitions *** -->
  </fields>

  <!-- *** Other Sunspot Configurations *** -->
</schema>

......

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文