指数未在SPHINX中旋转

时间:2013-01-21 11:31:49

标签: sql sphinx

我想使用2个索引(查询),但是sphinx给出了这个警告:

[sphinx@reea3 ~]$ /usr/bin/indexer --config /home/sphinx/sphinx/sphinx.conf --all --rotate
Sphinx 0.9.9-release (r2117)
Copyright (c) 2001-2009, Andrew Aksyonoff

using config file '/home/sphinx/sphinx/sphinx.conf'...
indexing index 'job1'...
collected 6 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 6 docs, 837 bytes
total 0.005 sec, 152988 bytes/sec, 1096.69 docs/sec
indexing index 'job2'...
collected 8 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 8 docs, 151 bytes
total 0.002 sec, 53794 bytes/sec, 2850.01 docs/sec
total 10 reads, 0.000 sec, 0.2 kb/call avg, 0.0 msec/call avg
total 20 writes, 0.000 sec, 0.3 kb/call avg, 0.0 msec/call avg
WARNING: failed to open pid_file '/var/run/sphinx/searchd.pid'.
WARNING: indices NOT rotated.

以下是源代码。 我已经取出了sql查询和属性列表。

为了让SPHINX旋转指数,需要做些什么?

#
# Minimal Sphinx configuration sample (clean, simple, functional)
#

source jobSource1
{
    type        = mysql
    sql_host    = localhost
    sql_user    = root
#   sql_pass    = 123456
    sql_pass    =
    sql_db      = dbx
    sql_port    = 3306
    sql_query   = sql_query
    sql_attr_uint = attributes go here
    sql_attr_str2ordinal = attributes go here
}

source jobSource2
{
    type        = mysql
    sql_host    = localhost
    sql_user    = root
#   sql_pass    = 123456
    sql_pass    =
    sql_db      = dbx
    sql_port    = 3306
    sql_query   = sql_query
    sql_attr_uint = attribute
    sql_attr_str2ordinal = attribute
}

index job1
{
    source      = jobSource1
    path        = /home/sphinx/jobs/job1
    docinfo     = extern
    charset_type    = utf-8
}

index job2
{
    source      = jobSource2
    path        = /home/sphinx/jobs/job1
    docinfo     = extern
    charset_type    = utf-8
}

indexer
{
    mem_limit   = 32M
}


searchd
{
    port        = 9312
    log     = /var/log/sphinx/searchd.log
    query_log   = /var/log/sphinx/query.log
    read_timeout    = 5
    max_children    = 30
    pid_file    = /var/run/sphinx/searchd.pid
    max_matches = 1000
    seamless_rotate = 1
    preopen_indexes = 0
    unlink_old  = 1
}

2 个答案:

答案 0 :(得分:4)

实际上,在与同事集体讨论后,我们与管理员进行了交谈,结果发现searchd进程是使用root权限进行初始化的,因此只有root用户才能修改该文件。

使用正常的权限重新启动进程后,everithing结果正常工作;

答案 1 :(得分:-1)

使用此命令sudo indexer --rotate --all