1

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

*/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 文件没有工作。有什么帮助吗?

4

1 回答 1

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
于 2015-10-05T16:31:43.490 回答