【问题标题】:rails 3 thinking-sphinx re-index failingrails 3 thinking-sphinx 重新索引失败
【发布时间】:2014-01-28 10:25:52
【问题描述】:

我一直在用思考狮身人面像指标来应对奇怪的行为。目前的状态是没有进行索引。

我使用不同的命令得到不同的行为。 cap deploy 在rebuild sphinx 命令下停止。

invoke_command "cd #{release_path} && RAILS_ENV=#{rails_env} bundle exec rake ts:rebuild"

手动索引命令

$ bundle exec rake ts:index --trace
** Invoke ts:index (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
FATAL:  sorry, too many clients already
/Users/me/app/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize'

手动 bundle exec rake ts:rebuild 的行为是一个很长的停顿,我最终会中断。

试图停止引擎有不同的错误。有一个足够长的档位 Ctrl-C 并返回:

$ bundle exec rake ts:stop --trace
** Invoke ts:stop (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute ts:stop
^Crake aborted!

/Users/me/app/shared/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/rake_interface.rb:56:in `sleep'

更新呜呜呜……我跑了

bundle exec rake ts:index --trace

直接在服务器的终端窗口中。索引开始写作。但最后得到了两个警告。

PID 82805 找不到进程

索引未旋转

这样画得更好吗?

** 更新 2 ** 数据

   ??  S    11:28AM   0:06.93 /usr/local/bin/searchd --pidfile --config /Users/me/app/releases/20140127084810/config/development.sphinx.conf
   ??  S    11:28AM   0:00.00 /usr/local/bin/searchd --pidfile --config /Users/me/app/releases/20140127084810/config/development.sphinx.conf
   ??  S    13Jan14   1:16.68 /usr/local/bin/searchd --pidfile --config /Users/me/rails/releases/20140113100039/config/development.sphinx.conf
 s001  R+    1:23PM   0:00.00 grep searchd

对于那些感兴趣的人,问题已通过两个讨论 one on settings 和另一个讨论 identifying the processes and acting upon them 得到解决

【问题讨论】:

    标签: ruby-on-rails-3.2 thinking-sphinx postgresql-9.2


    【解决方案1】:

    首先 - 对于 Capistrano 和 Thinking Sphinx,现在强烈建议您将生成的 Sphinx 配置文件设置为位于 shared directory 中。这可能是重建上限任务挂起的原因。

    至于警告 - 您能否确认 Sphinx 守护进程是否正在运行? ps aux | grep searchd 应该可以解决问题。如果是,则值得检查 pid 文件是否包含正确的 pid。如果它没有运行,那么最好删除 pid 文件,因为 Sphinx/Thinking Sphinx 假设不是这样。

    【讨论】:

    • 第一个数据点 sphinx.yml、thinking-sphinx.yml、development.sphinx.conf 都在 shared/config/ 中,看起来确实在运行。为了方便查看,我更新了 ps aux | 的结果。 grep 搜索它引用了两个运行 sphinx 的应用程序,但是我遇到问题的同一个应用程序的两个相同版本。 Pid 文件状态为 57009;不知道会产生什么样的关系。
    • 此应用程序引用的版本不是最新的。还有两个最近的。
    • 您使用的是 TS v3,因此根本没有引用 sphinx.yml。 thinking_sphinx.yml(注意下划线)应该在你的应用程序的配置目录中,但应该为你生成的配置文件(例如 production.sphinx.conf)和你的索引文件和 pid 文件指定路径,以便它们位于共享目录中的某个位置,没有需要符号链接。见本页第一段代码:pat.github.io/thinking-sphinx/deployment.html
    • 而且很可能会有不止一个 searchd 实例在运行(如果它正在运行的话),因为 Sphinx 使用 TS v3 的线程工作器。
    • 下划线,是的(我在评论中的错字)。 thinking_sphinx.yml 在 shared/config 中(应用程序的配置符号链接到共享目录)确实指向索引所在的 shared/sphinx。但是 configuration_file 和 pid_file 没有定义。 production.sphinx.conf 和 development.sphinx.conf 位于 shared/config 中,因此似乎已被采纳。我会添加这些。但是 searchd.pid - 原谅我的无知 - 它是在启动时自动生成的吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多