Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I recently finished creating a Rails 3.1 app that uses Sunspot for search. I've got it running on my server, however am having some issues with sunspot. I ran into the issue of encountering a "Connection refused - connect(2)" error every time I viewed a page with the search feature. I had come across this in development and the solution had been to run "rake sunspot:solr:start", however it would seem that this solution (even when setting the RAILS_EVN) doesn't work to fix the error this time around. I've tried various things including installing Tomcat which I thought might run the server as in the step here: https://github.com/outoftime/sunspot/wiki/Configure-Solr-on-Ubuntu,-the-quickest-way However, the only change I can see this made is that when running "rake sunspot:solr:start" I now get the error: "Server is already running with PID 21404". Indicating that the Sunspot server is running.

Obviously I have now run out of ideas to fix this connection refused error and so am seeking help from ServerFault.

Any help would be greatly appreciated,

Thanks In Advance,

Regards,

Joe

share|improve this question
I've basically installed Tomcat and Solr as I was told I need to, and my application has Sunspot search in. Could anyone help me check if my application's configuration and the Solr server are configured properly? – joesavage Sep 4 '11 at 19:13
On trying to reindex my sunspot, I also get "Connection refused - connect(2)".. – joesavage Sep 4 '11 at 19:48

1 Answer

up vote 1 down vote accepted

Asked via another medium and get enough help to fix the problem: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6629b4b9f7e10b5b/7e622f71d171a649

Answer:

After talking more with Hassan and long sessions of Troubleshooting - I managed to fix the issue. I firstly deleted the sunspot.yml file in the config folder of my rails application and replaced it with an initializer (sunspot.rb) in my config/initalizers directory which specified the sunspot path: Sunspot.config.solr.url = 'http://localhost:8983/solr' After doing this I stopped getting the errors while in development, although a reindex was required. When trying to reindex I then encountered the error: "Solr Response: Internal Server Error" At this stage I tried a variety of things to get it working - some/all of these may or may not have had a bearing on the getting it to work. I changed the file permissions (chmod, chown) of the files in my rails application to make sure they were all fully accessible and writable to by apache and solr, changed Java versions from OpenJDK to Oracle/ Sun JDK (sudo update-alternatives --config java) - I think this was the main fix to this problem, closed down another server that was running on the same port (plus closed down tomcat since it turns out it wasn't being used). After this - everything reindexed fine and it worked a treat! Closing the other server that was running on the same port also fixed an issue in which I got the "Connection refused - connect(2) " when running is production mode despite it working in development. Hope this helps other people that may be experiencing the same or similar problems!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.