Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

Setup sunspot solr with rails in production environment

I have tried various links but I can't seem to find a good resource on creating a running solr instance that works with rails in production.

I understand that you have to setup the solr server for production. I have tried the setup of solr with tomcat but I cant seem to link it to the rails app.

Is there any good resource out there that I could use?

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The Sunspot gem includes the sunspot-solr binary. The simplest setup would be just to run sunspot-solr start. Depending on how your application is deployed, you might also include a task in your Capistrano deploy that uses Sunspot's provided rake task to start a Solr server. Namely, rake sunspot:solr:start RAILS_ENV=production.

Getting more in-depth from that could involve: installing Tomcat as a standalone service, started and stopped with its own init script (or Upstart config), ideally monitored by monit or god; downloading and deploying solr.war within Tomcat, and configuring the solr.xml to refer to a convenient location on disk for your index data, solrconfig.xml and schema.xml to be stored.

The Solr wiki also includes a page on installing Solr with Tomcat and other servlet containers.

In either of the above self-hosted options, there's an important point to keep in mind with Sunspot: disable its automatic commits, and rely on Solr's own autoCommit settings in solrconfig.xml. You can disable those commits by setting auto_commit_after_request: false in your config/sunspot.yml.

Finally, if you're more interested in just outsourcing all of this, there's also my own humble hosted Solr service over at http://websolr.com/ — we can have you up and running in just a few clicks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...