开发者

Is this a simple way to ensure Sunspot Solr starts or this bad?

I have had many problems with Sunspot Solr not being started, particularly after server reboot initiated by the Host.

Now I am sure there are ways that I could create a startup script that my server would run, or maybe monit is the way to go. But I am think all I really need is to start the Solr server when my app starts, so开发者_开发问答 just now I put this in an initializer:

begin
  Sunspot::Rails::Server.new.start
rescue
  # solr is already running
end

Tried it locally and it seemed to work.

Is this terrible? Is there a quick and easy way that is better?


According to the Sunspot documentation they don't recommend using the built in instance for anything other than development.

From the Sunspot::Rails README:

To start up a Solr instance, issue the following:

rake sunspot:solr:start

Note that using the built-in Solr instance packaged with Sunspot is great for development, but is not recommended for production. See the Sunspot documentation for more information.

See this link for the referenced documentation (wiki entry): https://github.com/sunspot/sunspot/wiki/Configuring-solr-for-use-with-sunspot-in-development%2C-testing%2C-and-production

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜