Ruby on rails 太阳黑子轨道:无法建立连接,因为目标机器主动拒绝它

Ruby on rails 太阳黑子轨道:无法建立连接,因为目标机器主动拒绝它,ruby-on-rails,solr,sunspot,Ruby On Rails,Solr,Sunspot,我在rails应用程序上运行sunspot,并且可以(我假设)让搜索服务器运行“rake sunspot:solr:run”。不幸的是,当我试图访问搜索索引时,我在搜索控制器中遇到了ECONNREFUSED错误 我尝试过完全关闭防火墙,但没有成功。将sunspot.yml中的所有端口都更改为8983,也没有运气。我发现了命令“netstat-anb”,但不知道要查找什么进程。是什么导致了这个错误 编辑 下面的内容也没有帮助,因为rake太阳黑子:solr:start不起作用 Common Ini

我在rails应用程序上运行sunspot,并且可以(我假设)让搜索服务器运行“rake sunspot:solr:run”。不幸的是,当我试图访问搜索索引时,我在搜索控制器中遇到了ECONNREFUSED错误

我尝试过完全关闭防火墙,但没有成功。将sunspot.yml中的所有端口都更改为8983,也没有运气。我发现了命令“netstat-anb”,但不知道要查找什么进程。是什么导致了这个错误

编辑

下面的内容也没有帮助,因为rake太阳黑子: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。

听起来您有另一个solr实例正在运行。尝试删除所有实例并再次运行。

你的应用程序在哪里托管?Heroku?目前它在webrickI上本地运行,我曾经遇到过同样的问题。对我来说,唯一解决这个问题的方法就是卸载gem并从根目录中删除solr目录。然后我再次安装了gem,一切正常。您可以将代码保留在模型中。当然,可以使用
sunspot:solr:reindex
重新索引模型,以更改solr端口,请参见或