Welcome Guest | Login

restarting rails app & solr

I'm using the Solr search engine on my site with the acts_as_solr plugin in my rails app. The Solr search server runs separately from the Rails app so when I deploy, I need to start/stop it or when there is a server reboot or app restart it needs to be started again.  I set up a cron job for @reboot, but is there a way I can automatically run the rake task to start Solr when the app is restarted?  It seems that the app was restarted today without the server being rebooted.

2008-04-03 10:14 AM

Hi,

-> but is there a way I can automatically run the rake task to start Solr when the app is restarted?

You can add rake task with the restart script that you using.

2008-04-03 05:22 PM

I didn't actually restart the application myself.  I assumed it was restarted by whats in the error logs.

Is it ever the case that (besides server reboot) that the application would restart so my solr server would cease to be active?  

Putting it another way, does anyone have a good watcher script I could use in cron to test if the solr server is running and then restart it if it gets a 500 error?

2008-04-03 09:10 PM

you may just need to write the script to grab a URL from your site and if its 500error (only caused by solr being down, of course) then issue a solr restart.

We have a number of clients running Sphinx, which is generally more stable and less resource intensive than ferret or solr.  If you're interested have support install it on your server if it isn't already.

2008-04-04 12:24 AM

any pointers to examples I could use to base such a script on?

Sphinx sounds nice, but the Faceted Browsing of Solr is what is integral to much of the searching and navigating on my sites.

ex.) www.jcastle.info/castle/browse

2008-04-04 04:10 AM

You could write it in ruby - getting started would be something like:
http://snippets.dzone.com/posts/show/460

2008-04-04 11:43 AM

thanks. that looks good.  I'll give it a try.

2008-04-04 07:51 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!