无法在EC2机器上启动SOLR - 未检测到gem

时间:2012-12-13 17:48:22

标签: ruby-on-rails ruby-on-rails-3 solr sunspot

我最近在我的Amazon EC2机器上安装了SOLR,当我尝试使用RAILS_ENV=production bundle exec rake sunspot:solr:start --trace启动SOLR时,收到以下消息:

** Invoke sunspot:solr:run (first_time)
** Invoke sunspot:solr:moved_to_sunspot_solr (first_time)
** Execute sunspot:solr:moved_to_sunspot_solr

Note: This task has been moved to the sunspot_solr gem. 
To install, start and stop a local Solr instance, please add sunspot_solr to your Gemfile:

group :development do
  gem 'sunspot_solr'
end

但是,我已经在我的Gemfile中添加了sunspot_solr,而我的RAILS_ENV已经生成了(我也尝试了export RAILS_ENV=production有关为什么SOLR无法启动和保留的任何提示试图在开发中运行?我按照此链接安装它 - http://tanin.nanakorn.com/b/96/tomcat_and_solr_on_ec2

以下是我的Gemfile的一部分:

group :development, :test do
  gem 'factory_girl_rails'
  gem "rspec-rails"
  gem 'faker'
  gem 'fuubar'
  gem 'pry'
  gem 'foreman'
  gem 'guard-spork'
  gem 'sunspot_solr'
end

我已经运行bundle install并看到正在使用宝石:

Using rsolr (1.0.8)
Using sunspot (1.3.0) 
Using sunspot_rails (1.3.0) 

1 个答案:

答案 0 :(得分:3)

sunspot_solr gem位于Gemfile的:development组中,当您指定RAILS_ENV=production时,Rails会忽略它。 sunspot_solr gem主要是为了方便开发和测试,并没有特别针对生产进行调整,这就是文档建议将其包含在:development组中的原因。

如果您已按照链接的博客文章中描述的步骤进行操作,则实际上您不需要使用Sunspot的捆绑Solr实例。在该文章的最后,您应该在服务器上运行Solr服务器。 (您必须仔细检查Tomcat配置以查看它正在运行的端口。)

如果我可能如此大胆,您也可以从考虑云托管的Solr搜索中受益,例如我自己的websolr.com。您应该可以在几分钟内启动并运行索引。