sphinx delta搜索索引并在cron作业中合并

时间:2015-10-01 12:22:46

标签: sphinx delta-index

我在cron作业中实现了delta索引,这是

*/2 * * * * /usr/bin/indexer --config /etc/sphinx/sphinx.conf indexer sph_idx_posts_delta --rotate >  /var/log/cronlog4.log 2>&1

*/3 * * * * /usr/bin/indexer --config /etc/sphinx/sphinx.conf indexer  --merge post sph_idx_posts_delta --rotate  > /var/log/cronlog5.log 2>&1

在putty中运行时都运行正常,但在cron作业中运行时会在日志文件中出现以下错误。

Sphinx 2.2.9-id64-release (rel22-r5006)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/etc/sphinx/sphinx.conf'...
FATAL: there must be 2 indexes to merge specified

我必须为另外四张桌子做同样的事情,所有这些都给了我同样的错误。我搜索了这个错误并且它说创建一个bash文件而不是运行该文件中的所有代码但是我也没有工作,我的bash文件无效。有什么帮助吗?

1 个答案:

答案 0 :(得分:1)

您的命令中有冗余部分 - 索引器,您已经在开头指定了命令 - / usr / bin / indexer。所以,正确的变体是:

*/2 * * * * /usr/bin/indexer --config /etc/sphinx/sphinx.conf sph_idx_posts_delta --rotate >  /var/log/cronlog4.log 2>&1
*/3 * * * * /usr/bin/indexer --config /etc/sphinx/sphinx.conf --merge post sph_idx_posts_delta --rotate  > /var/log/cronlog5.log 2>&1