1

我想使用 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
}
4

2 回答 2

5

实际上,在与我的同事进行了一次头脑风暴之后,我们与管理员进行了交谈,结果发现 searchd 进程是使用 root 权限初始化的,因此只有 root 用户可以修改文件。

以正常权限重新启动该过程后,一切正常;

于 2013-01-21T21:42:13.757 回答
-1

使用这个命令sudo indexer --rotate --all

于 2014-06-12T07:37:24.427 回答