Search code examples
ruby-on-railssunspot-solr

Accessing the solr folder folder from multiple server instances


AWS has just announced general availability of its EFS (Elastic File System). It allows you to create a network drive that can be shared by multiple AWS instances.

I have a Rails application, using sunspot-solr gem. A solr folder is created to store the solr index file and other related data.

The MySQL data is on its own RDS instance. I want to deploy two servers, both running the same Rails application, but have them both point to the same solr folder on the shared EFS share.

Assuming that both servers running the Rails app, are using the same solr gem version, will my scenario work, or will each server need its own solr folder?


Solution

  • I'm pretty sure the version of Solr packed with the development version of Sunspot is a separate Solr server that Rails communicates with. So in production, you are responsible for providing a Solr server for these purposes, be it on one of your EC2 instances or on its own separate EC2 instance.

    A little more info... Rails posts data for Solr to consume via Sunspot, but the Solr server handles those details, not your Ruby app. Therefore, sharing the Solr data files with Rails won't provide you with any advantage.

    When I was getting started, I hooked my Heroku-hosted Rails app up to Websolr if you think that $20+ per month would be worth it. Otherwise, look up tips for installing Solr on EC2.