2

我正在尝试将 Sphinx main + delta 系统与 Sphinx 一起使用。除了 Cron 工作不断WARNING: no such index 'listings_delta_index', skipping从日志中说出来,我一切都正常了。当我手动运行命令时,它工作得很好。我正在运行的命令和我正在使用的 sphinx.conf 如下。我还尝试将索引名称更改为 listings_index ,但这也不起作用。

狮身人面像.conf

source listings_source
{
    type            = mysql
    sql_host        = localhost
    sql_user        = user2
    sql_pass        = password
    sql_db          = MyVirtuals
    sql_port        = 3306  # optional, default is 3306
    sql_query_pre   = SET NAMES utf8
    sql_query_pre   = REPLACE INTO sph_counter SELECT 1, MAX(listing_id) FROM     listings
    sql_query_pre   = REPLACE INTO sph_last_index SELECT 1, NOW()
    sql_query       = \
    SELECT listing_id, title,CRC32(mainCategoryID) as mainCategoryID,CAST(price AS DECIMAL(12,2)) as price, UNIX_TIMESTAMP(date_created) AS date_created, description \
    FROM listings WHERE listing_id<=(SELECT max_doc_id FROM sph_counter WHERE counter_id=1) AND status = 1
    sql_query_killlist  = SELECT listing_id FROM listings WHERE modified_on >= (SELECT last_reindex_on FROM sph_last_index WHERE counter_id=1)

    sql_attr_timestamp  = date_created
    sql_attr_uint   = mainCategoryID
    sql_attr_float  = price

    #sql_query_info = SELECT * FROM documents WHERE id=$id
}
index listings_index
{
    source      = listings_source
    path        = /usr/local/sphinx/var/data/listings_index
    docinfo     = extern
    charset_type    = sbcs
    min_word_len    = 1
    html_strip      = 1
}
source listings_delta_source : listings_source{
    sql_query_pre       = SET NAMES utf8
    #Pull listings that are new and changed
    sql_query       = SELECT listing_id, title, CRC32(mainCategoryID) as mainCategoryID, CAST(price AS DECIMAL(12,2)) as price, UNIX_TIMESTAMP(date_created) AS date_created, description \
    FROM listings WHERE listing_id>(SELECT max_doc_id FROM sph_counter WHERE counter_id=1) OR modified_on >= (SELECT last_reindex_on FROM sph_last_index WHERE counter_id=1)
}
index listings_delta_index : listings_index{

        source      = listings_delta_source
        path        = /usr/local/sphinx/var/data/listings_delta_index
        docinfo     = extern
        charset_type    = sbcs
        min_word_len    = 1
        html_strip      = 1
}
indexer
{
    mem_limit       = 32M
}
searchd
{
    listen      = 9312
    listen      = 9306:mysql41
    log         = /var/log/sphinxsearch/searchd.log
    query_log       = /var/log/sphinxsearch/query.log
    read_timeout    = 5
    max_children    = 30
    pid_file        = /var/log/sphinxsearch/searchd.pid
    max_matches     = 1000
    seamless_rotate = 1
    preopen_indexes = 1
    unlink_old      = 1
    workers     = threads # for RT to work
    binlog_path     = /usr/local/sphinx/var/data
}

sphinx_update_delta.sh

indexer -c /var/www/scripts-conf/sphinx.conf --rotate listings_delta_index

crontab

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report     /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
*/1 *    * * *   root    sh /var/www/scripts-conf/sphinx_update_delta.sh > /var/log/cronlog.log
*  0    * * *   root    sh /var/www/scripts-conf/sphinx_update_main.sh

有人可以帮我解决这个问题吗?

4

1 回答 1

1

indexer -c /var/www/scripts-conf/sphinx.conf --rotate Listings_delta_index

sphinx.conf 是小写的

在您的第一个块中,您写为标题 Sphinx.conf(不是 sphinx.conf)


尖端

sh /var/www/scripts-conf/sphinx_update_delta.sh > /var/log/cronlog.log

>替换为| 球座

sh /var/www/scripts-conf/sphinx_update_delta.sh | tee /var/log/cronlog.log

查看手动运行的结果

于 2013-05-21T17:46:32.203 回答