跳过非普通指数rt(sphinx 2.1.6)

时间:2014-12-08 07:29:13

标签: sphinx

有问题。 Sphinx,版本2.1.6。我以前用rt(实时)索引,但在koncole中索引显示消息时:

using config file 'sphinx.conf'...
skipping non-plain index 'rt'...

但是在与sphinxbase的连接和写入查询mysql> desc rt - displays:

+------------+--------+
| Field      | Type   |
+------------+--------+
| id         | bigint |
| id         | field  |
| first_name | field  |
| last_name  | field  |
+------------+--------+

这是默认数据??他们不符合我的要求。如何使用索引rt?

sphinx.conf中。

source database
{
        type                    = mysql
        sql_host                = 127.0.0.1
        sql_user                = test
        sql_pass                = test
        sql_db                  = community
        sql_port                = 3306



        mysql_connect_flags     = 32 # enable compression

        sql_query_pre           = SET NAMES utf8
        sql_query_pre           = SET SESSION query_cache_type=OFF 
}

source rt : database
{   
        sql_query_range         = SELECT MIN(id),MAX(id) FROM mbt_accounts

        sql_query               = SELECT id AS 'accountId', first_name AS 'fname', last_name AS 'lname' FROM  mbt_accounts WHERE id >= 0 AND id<= 1000


        sql_range_step = 1000

        sql_ranged_throttle = 1000 # milliseconds


}

index rt
{
    source          = rt
        type                    = rt
        path                    = /etc/sphinxsearch/rtindex
        rt_mem_limit            = 700M

    rt_field                = accountId
        rt_field                = fname
        rt_field                = lname

        rt_attr_string          = fname
        rt_attr_string          = lname

        charset_type            = utf-8

        charset_table = 0..9, A..Z->a..z, _, -, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F, U+401->U+451, U+451
}


searchd
{
        listen                  = localhost:9312 # port for API
        listen                  = localhost:9306:mysql41 #port for a SphinxQL

        log                     = /var/log/sphinxsearch/searchd.log
        binlog_path         = /var/log/sphinxsearch/

        query_log               = /var/log/sphinxsearch/query.log
        query_log_format        = sphinxql

        pid_file                = /var/run/sphinxsearch/searchd.pid

        workers                 = threads

        max_matches             = 1000

        read_timeout            = 5

        client_timeout          = 300

        max_children            = 30    

        max_packet_size         = 8M

        binlog_flush            = 2

        binlog_max_log_size     = 90M

        thread_stack            = 8M

        expansion_limit         = 500

        rt_flush_period         = 1800

        collation_server        = utf8_general_ci

        compat_sphinxql_magics  = 0

        prefork_rotation_throttle       = 100

}

感谢。

1 个答案:

答案 0 :(得分:0)

indexer仅适用于具有&#39;来源&#39; - 即普通磁盘索引。即索引器执行源中的东西以获取数据以创建索引。

RT(实时)索引的工作方式非常不同。 indexer根本不涉及RT索引。它们完全由searchd处理。

要将数据添加到RT索引,您需要运行一堆实际将数据添加到索引的SphinxQL命令(INSERT,UPDATE等)。

(DESCRIBE有效,因为searchd知道索引的结构(你通过rt_field等告诉它) - 即使从未插入过任何数据)


啊,我想你在问为什么结构不同。这可能是因为索引可能是之前创建的,你修改了sphinx.conf。如果您更改RT索引的定义,则需要“销毁”&#39;索引,允许再次重新创建。

最简单的方法是关闭searchd,删除索引文件,删除binlog(它不再相关),然后重新启动searchd。

searchd --stopwait
rm /etc/sphinxsearch/rtindex*
rm /path/to/binlog*  #(you dont define a path, so it must be the default, which varies) 
searchd #(starts searchd again)