【发布时间】:2013-02-19 01:07:23
【问题描述】:
我在 Rails 应用程序上运行 sunspot,并且可以(我假设)让搜索服务器使用“rake sunspot:solr:run”运行。不幸的是,当我尝试访问搜索索引时,我的搜索控制器中出现 ECONNREFUSED 错误。
我尝试完全关闭防火墙,但没有成功。将 sunspot.yml 中的所有端口更改为 8983 也没有运气。我发现了命令“netstat -anb”,但不知道要查找什么进程。什么可能导致此错误?
编辑
以下内容也没有帮助,因为 rake sunspot:solr:start 不起作用。
Common Initial Troubleshooting.
If you see: Errno::ECONNREFUSED (Connection refused - connect(2)) Then perhaps:
You have not started the solr server:
$ rake sunspot:solr:start
An error occurred in starting the solr server (such as not having the Java Runtime Environment installed). do
$ rake sunspot:solr:run
to run the server in the foreground and check for errors.
If you come across this error in testing but not development, then perhaps you have not invoked the task with the correct environment:
$ RAILS_ENV=test rake sunspot:solr:run
编辑 2 sunspot:solr:run 还在终端中显示以下内容,但似乎继续在终端中加载其他详细信息:
WARN: failed SocketConnector @ 0.0.0.0:8983
java.net.BindException: Address already in use: JVM_Bind
:WARN: EXCEPTION
java.net.BindException: Address already in use: JVM_Bind
更多详情
INFO: Started SocketConnector @ 0.0.0.0:8983
我如何更改端口,因为 java.exe 也在此端口上侦听。我更改了 sunspot.yml 和 scripts.conf,但 solr:run 仍然连接到端口 8983。
【问题讨论】:
-
您在哪里托管您的应用程序? Heroku?
-
目前在webrick本地运行
-
我曾经遇到过同样的问题。为我解决它的唯一方法是卸载 gem 并从根目录中删除 solr 目录。然后我再次安装了 gem,一切正常。您可以将代码原样保留在模型中。当然,使用
sunspot:solr:reindex重新索引您的模型
标签: ruby-on-rails solr sunspot