ruby-on-rails - 生产服务器上的 Sunspot/Solr

标签 ruby-on-rails ruby tomcat solr sunspot

刚刚从 Sphinx 转移到 Solr/Sunspot Gem for Rails, 使用带有 RAILS_ENV=production rake sunspot:solr:start 的 gem 'sunspot_solr' 在生产服务器上运行 Solr。

经过一整天的索引,早上所有的索引都消失了,没有错误,也没有任何关于发生的事情的日志。第二天也发生了同样的事情。

经过一些研究,我注意到了这一点:

Sunspot comes with a prepackaged instance of Solr, which makes it easy to get started in development mode. This will store the index data in your operating system’s temporary directory

我怀疑“rake sunspot:solr:start”仅用于开发,数据不是持久的。但是有很多教程使用这种方式在没有 Tomcat 的生产服务器上启动 Solr。

在生产环境中设置 Solr 的正确方法是什么,我必须使用 Tomcat,还是“rake sunspot:solr:start”是启动 Solr 的正确方法。

我很困惑,感谢任何帮助。

最佳答案

有一个 whole page on the community wiki dedicated to taking Solr to production如果您的发行版不提供初始化脚本等示例(或在 Windows 下运行)。

最简单的方法是使用 bin/install_solr_service.sh 脚本:

Solr includes a service installation script (bin/install_solr_service.sh) to help you install Solr as a service on Linux. Currently, the script only supports CentOS, Debian, Red Hat, SUSE and Ubuntu Linux distributions. Before running the script, you need to determine a few parameters about your setup. Specifically, you need to decide where to install Solr and which system user should be the owner of the Solr files and process.

这使用受支持的捆绑版本的 Jetty 和 Solr,并将其正确设置为服务器上的服务。

Windows下目前推荐的方式是使用NSSM .

关于ruby-on-rails - 生产服务器上的 Sunspot/Solr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45565430/

相关文章:

ruby-on-rails - 在 Rails 中使用 Mustache 渲染邮件模板

ruby-on-rails - 将保存的 Rails 参数从字符串中取回参数

ruby - Twilio 应用; twilio-ruby (3.4.2),SSL 错误

ruby-on-rails - 没有路由匹配 { :controller= >"stocks", :action= >"create"} RSpec Rails 3

ruby-on-rails - 使用 RVM 成功安装 Ruby 1.9.2,但现在恢复到 1.8.7

ruby-on-rails - 我怎样才能清除在父 Controller 中定义的方法?

ruby-on-rails - 当用户是管理员时保存对象时的不同行为

Tomcat Maven 插件在 webapp 部署时抛出异常

java - 从 Tomcat 6.0.18 升级会出现新的异常

java - 优化 Tomcat/垃圾收集