Reputation:
Pretty much I'm trying to deploy a Rails application that uses Sunspot. I've followed https://github.com/outoftime/sunspot/wiki/Configure-Solr-on-Ubuntu,-the-quickest-way, but when running the application I get the following:
Connection refused - connect(2)
This indicates that it can't access the server properly, and I've been googling and trying things for hours, but to no avail.
Any ideas?
Upvotes: 3
Views: 6672
Reputation: 82
This blog may solve your question:
Install Solr 4.4 with Jetty in CentOS, and set up Solr server to work with Sunspot Gem. ( http://blogs.pigrider.com/blogs/26 )
Below are some parts from the blog: ......
8) Copy this configuration file schema.yml from your Rails application to the home directory of the running Solr 4.4 instance. It will overrider the Solr example configuration file there, and it will set up Solr 4.4 server to work with Sunspot Gem. cp /RailsApplicationPath/Solr/conf/schema.yml /opt/solr/solr/collection1/conf/.
The home directory of the running Solr 4.4 instance is /opt/solr/solr/collection1/. You can find this information from Solr admin page http:// l o c a l h o s t :8983/solr/admin
9) Add version field into the configuration file schema.yml to satisfy Solr 4.4 initialization requirement. Actually, two lines of code need to be added into the file. They are:
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
The configuration file schema.yml eventually will look like:
<schema name="sunspot" version="1.0">
<types>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<!-- *** Other Sunspot fieldType Definitions *** -->
</types>
<fields>
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
<!-- *** Other Sunspot field Definitions *** -->
</fields>
<!-- *** Other Sunspot Configurations *** -->
</schema>
......
Upvotes: 0
Reputation: 96
You can try reindexing
$rake sunspot:solr:reindex RAILS_ENV=production
If that doesn't work, you can...
$rm solr/pids/production/sunspot-solr-production.pid
...start solr
$rake sunspot:solr:start RAILS_ENV=production
...and reindex again
$rake sunspot:solr:reindex RAILS_ENV=production
Upvotes: 5
Reputation:
It turns out that in the end, after all the troubleshooting, the problem was just the port number in the config file (in some drawn out way) -- i.e. Sunspot.config.solr.url
.
Upvotes: 3
Reputation: 1362
Could anyone help me get this working?
$rake sunspot:solr:start RAILS_ENV=production$
Setup sunspot solr with rails in production environment indicates that it is, indeed, as simple as this.
can you be specific as to the problem(s) you had when you tried this? or what caused you to not try it? because installing solr/tomcat/etc is a lot more work than typing that one line of code.
you may also have luck with http://internetmodulation.com/2011/01/10/sunspot-solr-tomcat-ubunut.html.html if you decide to have a full tomcat/solr install.
Upvotes: 2