Reputation: 1287
I have a rails app which uses sunspot/solr for search capability. This app works well in development, but now that I'm trying to deploy it to a server Im having trouble.
I'm using a Digital Ocean droplet with the Dokku 0.5.4 on Ubuntu 14.04 one click image.
The first time I tried to get Solr up and running I followed the directions on the official sunspot github page. Despite following the directions to the letter, I was unable to get my app to talk to Solr.
Since the tutorials found in the linked guide were a little old. I decided to spin up an entirely new droplet and try again, this time with the slightly more recent directions found here. After following these directions verbatim, I'm still having connection issues with my rails app.
Here is the error I'm getting
RSolr::Error::ConnectionRefused: Connection refused - {:data=>"<?xml version=\"1.0\" encoding=\"UTF-8\"?><add><doc><field name=\"id\">Person 3</field><field name=\"type\">Person</field><field name=\"type\">ActiveRecord::Base</field><field name=\"class_name\">Person</field><field boost=\"2\" name=\"first_name_text\">Joe</field><field name=\"last_name_text\">Schmoe</field><field name=\"email_text\">[email protected]</field></doc></add>", :headers=>{"Content-Type"=>"text/xml"}, :method=>:post, :params=>{:wt=>:ruby}, :query=>"wt=ruby", :path=>"update", :uri=>#<URI::HTTP http://localhost:8983/solr/solr_sunspot_example/update?wt=ruby>, :open_timeout=>nil, :read_timeout=>nil, :retry_503=>nil, :retry_after_limit=>nil}
I should point out that when I navigate to mydomain.com:8983 I can see that the solr server is working. Also, when I run service solr status
I get the following.
Found 1 Solr nodes:
Solr process 1164 running on port 8983
{
"solr_home":"/var/solr/data/",
"version":"5.2.1 1684708 - shalin - 2015-06-10 23:20:13",
"startTime":"2016-04-15T19:38:29.651Z",
"uptime":"0 days, 0 hours, 24 minutes, 17 seconds",
"memory":"93.7 MB (%19.1) of 490.7 MB"}
Here is my sunspot.yml file
production:
solr:
hostname: localhost
port: 8983
log_level: WARNING
path: /solr/solr_sunspot_example
This is the first time I've tried to use sunspot/solr and I'm not able to see where Im messing up. Have I setup solr the right way?
Upvotes: 1
Views: 1346
Reputation: 2061
Most probably, your Solr is not set up to listen to the localhost interface and only listens to mydomain.com interface.
To verify this assumption, do curl localhost:8983/solr/solr_sunspot_example
and curl mydomain.com:8983/solr/solr_sunspot_example
from your instance. If the second command succeeds, while the first one does not that would be the case.
You would have 2 options to solve it: either point your configuration to query the mydomain.com interface, or change Solr configuration to listen on the localhost interface. The later will be controlled by the hostname setting in the sunspot.yml (see the github wiki page you're referencing above).
Upvotes: 2
Reputation: 103
May be missing user and password in production config ?
production:
solr:
hostname: point_to_solr_host
port: 443
log_level: WARNING
path: /solr/solr_sunspot_example
user: <%= ENV["SOLR_USER"] %>
password: <%= ENV["SOLR_PASSWORD"] %>
Upvotes: 0