2014-12-08 58 views
0

有問題。獅身人面像,版本2.1.6。我用RT(實時)的索引,但在koncole索引顯示消息時:跳過非簡單索引rt(sphinx 2.1.6)

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 

} 

謝謝。

回答

0

indexer只適用於有'源'索引 - 即普通磁盤索引。即索引器在源中獲取數據以創建索引。

RT(實時)索引的工作方式非常不同。 indexer完全不涉及RT索引。他們完全由searchd處理。

要將數據添加到RT索引,您需要運行一組實際將數據添加到索引的SphinxQL命令(INSERT,UPDATE等)。

(形容作品,因爲searchd的知道該指數的「結構」(您通過rt_field等),告訴它 - 即使從來沒有插入任何數據)


啊,我以爲你會問,爲什麼結構不同。這可能是因爲索引可能是之前創建的,您修改了sphinx.conf。如果您更改RT索引的定義,則需要「銷燬」索引,以便再次重新創建索引。

最簡單的方法是關閉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)