无法启动sphinxsearch - 无法打开* .lock

时间:2015-07-26 20:57:31

标签: sphinx

运行sudo service sphinxsearch start时会出现此错误:

using config file '/etc/sphinxsearch/sphinx.conf'...
WARNING: compat_sphinxql_magics=1 is deprecated; please update your application and config
listening on 127.0.0.1:3307
precaching index 'items_item'
WARNING: index 'items_item': preload: failed to open /var/data/items_item.lock: Permission denied; NOT SERVING
precaching index 'reviews_feedback'
WARNING: index 'reviews_feedback': preload: failed to open /var/data/reviews_feedback.lock: Permission denied; NOT SERVING
FATAL: no valid indexes to serve
 ERROR.

这是我的conf文件:

index items_item
{
    type              = rt

    # List all fields
    rt_field          = name
    rt_attr_uint      = created_by_id
    rt_attr_uint      = category_id

    path              = /var/data/items_item
    docinfo           = extern
    morphology        = none
    min_word_len      = 2
    charset_type      = utf-8

    # "example" with min_prefix_len=3 -> "exa", "exam", "examp", "exampl"    
    min_prefix_len    = 0

    # "test" with min_infix_len=2 -> "te", "es", "st", "tes", "est" 
    min_infix_len     = 0
}

index reviews_feedback
{
    type              = rt

    # List all fields
    rt_field          = body
    rt_attr_uint      = created_by_id
    rt_attr_uint      = is_positive
    rt_attr_uint      = item_id

    path              = /var/data/reviews_feedback
    docinfo           = extern
    morphology        = none
    stopwords         = sphinx_fedbacks_stopwords.txt
    min_word_len      = 2
    charset_type      = utf-8

    # "example" with min_prefix_len=3 -> "exa", "exam", "examp", "exampl"    
    min_prefix_len    = 0

    # "test" with min_infix_len=2 -> "te", "es", "st", "tes", "est" 
    min_infix_len     = 0   
}

indexer
{
    # memory limit, in bytes, kilobytes (16384K) or megabytes (256M)
    # optional, default is 32M, max is 2047M, recommended is 256M to 1024M
    mem_limit           = 32M

    # maximum IO calls per second (for I/O throttling)
    # optional, default is 0 (unlimited)
    max_iops            = 60
}

searchd
{
    listen = localhost:3307:mysql41

    # log file, searchd run info is logged here
    # optional, default is 'searchd.log'
    # log               = /usr/local/sphinx/log/searchd.log

    # query log file, all search queries are logged here
    # optional, default is empty (do not log queries)
    # query_log         = /usr/local/sphinx/log/query.log
    # query_log_format  = 'sphinxql'

    # client read timeout, seconds
    # optional, default is 5
    read_timeout        = 5

    # maximum amount of children to fork (concurrent searches to run)
    # optional, default is 0 (unlimited)
    max_children        = 30

    # PID file, searchd process ID file name
    # mandatory
    pid_file            = /usr/local/sphinx/log/searchd.pid

    # max amount of matches the daemon ever keeps in RAM, per-index
    # WARNING, THERE'S ALSO PER-QUERY LIMIT, SEE SetLimits() API CALL
    # default is 1000 (just like Google)
    max_matches         = 1000

    # seamless rotate, prevents rotate stalls if precaching huge datasets
    # optional, default is 1
    seamless_rotate     = 1

    # whether to forcibly preopen all indexes on startup
    # optional, default is 0 (do not preopen)
    preopen_indexes     = 0

    # whether to unlink .old index copies on succesful rotation.
    # optional, default is 1 (do unlink)
    unlink_old          = 1

    workers = threads
}

索引器会跳过RT索引;据我所知,searchd需要* .lock文件,这些文件在路径中显示。

那么如何创建这些锁文件呢?

1 个答案:

答案 0 :(得分:1)

此问题的常见原因是您的sphinx实例没有干净关闭,并且上次运行的lock文件仍然存在。要再次运行您的实例,您必须先删除旧的lock文件并尝试启动您的实例。