Thinking Sphinx - 当我尝试重新索引时出错?
好的,我的服务器上有一个 Rails 应用程序,并且安装了 thinking shinx 。每天中午 12:30 我都会运行一个 cron 作业,截断帐户和联系人表并重新插入它们...这是我的 crons
30 0 * * * /bin/bash -l -c 'cd /var/www/active && script/rails runner -e production '\''Account.db_insert'\$
34 0 * * * /bin/bash -l -c 'cd /var/www/active && RAILS_ENV=production bundle exec rake ts:index --silent'
34 0 * * * /bin/bash -l -c 'cd /var/www/active && RAILS_ENV=production bundle exec rake ts:restart --silent'
如您所见,crons 执行 Account.db_insert
重新插入联系人和帐户,但每天我都会收到一封包含错误的电子邮件......这是我最近收到的两封......
昨天错误
using config file '/var/www/active/config/production.sphinx.conf'...
indexing index 'contact_core'...
FATAL: failed to lock /var/www/active/db/sphinx/production/contact_core.spl: Resource temporarily unavailable, will not index. Try --rotate option.
今天错误
using config file '/var/www/active/config/production.sphinx.conf'...
indexing index 'contact_core'...
collected 403 docs, 0.0 MB
sorted 0.1 Mhits, 100.0% done
ERROR: index 'contact_core': rename /var/www/active/db/sphinx/production/contact_core.tmp.spl to /var/www/active/db/sphinx/production/contact_core.new.spl failed: No such file or directory.
total 403 docs, 25092 bytes
total 0.069 sec, 361571 bytes/sec, 5807.16 docs/sec
distributed index 'contact' can not be directly indexed; skipping.
total 5 reads, 0.001 sec, 133.7 kb/call avg, 0.2 msec/call avg
total 10 writes, 0.012 sec, 177.8 kb/call avg, 1.2 msec/call avg
知道什么吗我做错了......
更新
在建议运行后
/usr/local/bin/indexer --config /etc/sphinxsearch/sphinx.conf --all --rotate
我收到此错误
using config file '/etc/sphinxsearch/sphinx.conf'...
ERROR: unknown key name 'client_timeout' in /etc/sphinxsearch/sphinx.conf line 591 col 16.
FATAL: failed to parse config file '/etc/sphinxsearch/sphinx.conf'.
Ok so i have a rails application on our server and I have thinking shinx installed. Every day at 12:30am I run a cron job that truncates the account and contact tables and reinserts them...here is my crons
30 0 * * * /bin/bash -l -c 'cd /var/www/active && script/rails runner -e production '\''Account.db_insert'\$
34 0 * * * /bin/bash -l -c 'cd /var/www/active && RAILS_ENV=production bundle exec rake ts:index --silent'
34 0 * * * /bin/bash -l -c 'cd /var/www/active && RAILS_ENV=production bundle exec rake ts:restart --silent'
As you can see the crons executes the Account.db_insert
which reinserts contacts and accounts but everyday I get an email with an error....here are the two that i got recently....
Yesterdays Error
using config file '/var/www/active/config/production.sphinx.conf'...
indexing index 'contact_core'...
FATAL: failed to lock /var/www/active/db/sphinx/production/contact_core.spl: Resource temporarily unavailable, will not index. Try --rotate option.
Todays Error
using config file '/var/www/active/config/production.sphinx.conf'...
indexing index 'contact_core'...
collected 403 docs, 0.0 MB
sorted 0.1 Mhits, 100.0% done
ERROR: index 'contact_core': rename /var/www/active/db/sphinx/production/contact_core.tmp.spl to /var/www/active/db/sphinx/production/contact_core.new.spl failed: No such file or directory.
total 403 docs, 25092 bytes
total 0.069 sec, 361571 bytes/sec, 5807.16 docs/sec
distributed index 'contact' can not be directly indexed; skipping.
total 5 reads, 0.001 sec, 133.7 kb/call avg, 0.2 msec/call avg
total 10 writes, 0.012 sec, 177.8 kb/call avg, 1.2 msec/call avg
Any Idea what I am doing wrong....
UPDATE
After the suggestion to run
/usr/local/bin/indexer --config /etc/sphinxsearch/sphinx.conf --all --rotate
I got this error
using config file '/etc/sphinxsearch/sphinx.conf'...
ERROR: unknown key name 'client_timeout' in /etc/sphinxsearch/sphinx.conf line 591 col 16.
FATAL: failed to parse config file '/etc/sphinxsearch/sphinx.conf'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如错误消息所示,您可能需要使用
--rotate
开关运行索引器。我也使用 Thinking Sphinx,但发现直接使用 Sphinx 索引器更容易。我让 Thinking Sphinx 为我生成配置,然后我可以在我的 cron 中直接调用
searchd
和indexer
:我发现这比通过Rake 任务。此外,它的速度要快得多,因为不需要加载整个 Rails 堆栈。
As the error message indicates, you might want to run the indexer with the
--rotate
switch.I, too, use Thinking Sphinx but found it easier to just use the Sphinx indexer directly. I have Thinking Sphinx generate my config for me, then I can just call out to
searchd
andindexer
directly, in my cron:I have foundthis to be more helpful than going through the Rake tasks. In addition, its much faster as the whole Rails stack doesnt have to be loaded.