2

I'm having an issue wherein I get an ECONNREFUSED error when I try to perform a search using sunspot_rails. The gems (sunspot_rails and sunspot_solr) both seem to be installed properly. I'm running version 1.3.3 and I have the server running correctly.

I've found another post about this, but the post only recommended starting the sunspot solr server. I've definitely done that, but the error persists.

I believe the problem is due to the port the server is on. When I look at the output from RAILS_ENV=development rake sunspot:solr:run, it shows that the server is running on port 8983. I've also tried the command RAILS_ENV=production rake sunspot:solr:run with the same effect.

If I examine the sunspot.yml config file, it shows the following:

production:
  solr:
    hostname: localhost
    port: 8983
    log_level: WARNING

development:
  solr:
    hostname: localhost
    port: 8982
    log_level: INFO

test:
  solr:
    hostname: localhost
    port: 8981
    log_level: WARNING

Notice that it's supposed to be on port 8982 for development, but no matter what I do it seems to keep restarting the server on port 8983. Any idea how this could be happening?

Thanks!

Update: I've found a potential cause. In my project folder, the file /solr/conf/scripts.conf contains the following: solr_port=8983. This seems to imply a hardcoded port no matter what Rails environment is active.

aardvarkk
  • 14,955
  • 7
  • 67
  • 96
  • 1
    I have noticed that occasionally the rake tasks for sunspot will not actually stop solr. This could result the next time you try to start solr, it says it started but actually fails. Try manually killing the solr process. Once you are sure it is not running, try starting with the desired environment. – Ben Miller Jul 19 '12 at 16:46
  • @BenMiller Hmm, I'm on a Windows machine -- issuing the command `rake sunspot:solr:stop` is met with the message: `This command is not supported on i386-mingw32. Use rake sunspot:solr:run to run Solr in the foreground.` Is there another way to kill the solr process? – aardvarkk Jul 19 '12 at 16:54
  • I haven't use Sun Spot on windows. Not sure where to go from here. You could check your task manager and make sure there isn't a process running. – Ben Miller Jul 19 '12 at 19:35
  • It's a bug form Sunspot. And as I can see, you know it :) https://github.com/sunspot/sunspot/issues/262 – Adrien Jul 20 '12 at 09:39
  • @AdrienGiboire Hah, yeah, I figured it out last night and submitted the bug. Heck, I'll give you the bounty for the other one and answer this one myself. Thanks for looking into it! – aardvarkk Jul 20 '12 at 14:38

1 Answers1

0

Turns out it was a bug in Sunspot. Here's a link to the issue I filed for a full description:

https://github.com/sunspot/sunspot/issues/262

My workaround was to edit the .yml file and change all ports (test, development, and production) to 8983.

aardvarkk
  • 14,955
  • 7
  • 67
  • 96