需要标识使用bigint作为sphinx的id
./configure --prefix=/path/you/want --enable-id64
make install
写好实时索引的配置文件
vim etc/sphinx.conf index testrt { type = rt rt_mem_limit = 32M path = /sphinxhome/var/data/testrt docinfo = extern mlock = 0 morphology = none min_word_len = 1 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 ngram_len = 1 ngram_chars = U+3000..U+2FA1F html_strip = 0 rt_field = content rt_field = addr rt_attr_string = province rt_attr_string = city rt_attr_uint = rank } indexer { mem_limit = 32M } searchd { listen = 9312 listen = 9306:mysql41 log = /sphinxhome/var/log/searchd.log query_log = /sphinxhome/var/log/query.log read_timeout = 5 max_children = 30 pid_file = /sphinxhome/var/log/searchd.pid max_matches = 1000 seamless_rotate = 1 preopen_indexes = 1 unlink_old = 1 workers = threads # for RT to work binlog_path = /sphinxhome/var/data rt_flush_period = 900 compat_sphinxql_magics = 0 }
重启sphinx的小脚本
#!/bin/sh bin/searchd --stop rm -rf var/data/* bin/searchd
进入sphinx的mysql,主要检查id是否为bigint
mysql -h 127.0.0.1 -P 9306 desc testrt; select * from testrt where match('haha'); insert into testrt(id, content, addr, province, city) values(1234567890, 'content', 'addr', 'province', 'city);