Sphinx
Posted 冯俊杰
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Sphinx相关的知识,希望对你有一定的参考价值。
停止sphix服务:sudo systemctl stop searchd
查看sphix状态:sudo systemctl status searchd
进入sphix文件目录:cd /var/lib/sphinx/
删除已生成的文件: sudo rm *
进入配置文件目录:cd /etc/sphinx/
编辑配置文件:sudo vim sphinx.conf
重启sphix:sudo systemctl start searchd
进入文件目录:cd /var/lib/sphinx/
查看sphix状态:sudo systemctl status searchd
查看起的服务:netstat -lnt
sphinx.conf
#
# Minimal Sphinx configuration sample (clean, simple, functional)
#
index merchant
{
type = rt
rt_mem_limit = 128M
dict = keywords
min_infix_len = 3
expand_keywords = 1
path = /var/lib/sphinx/merchant
rt_attr_string = code
rt_attr_string = name
rt_field = code
rt_field = name
rt_field = pinyin
}
index user
{
type = rt
rt_mem_limit = 128M
dict = keywords
min_infix_len = 3
expand_keywords = 1
path = /var/lib/sphinx/user
rt_attr_string = code
rt_attr_string = name
rt_field = code
rt_field = name
rt_field = pinyin
}
index car
{
type = rt
rt_mem_limit = 512M
dict = keywords
min_infix_len = 3
expand_keywords = 1
path = /var/lib/sphinx/car
rt_attr_string = name
rt_field = brand
rt_field = manufacturer
rt_field = series
rt_field = model
rt_field = build
}
index parts
{
type = rt
rt_mem_limit = 512M
dict = keywords
min_infix_len = 3
expand_keywords = 1
path = /var/lib/sphinx/parts
rt_attr_string = code
rt_attr_string = name
rt_attr_string = oe
rt_attr_string = brand
rt_attr_string = category
rt_attr_string = type
rt_field = code
rt_field = oe
rt_field = normalized
rt_field = name
rt_field = pinyin
}
index brand
{
type = rt
rt_mem_limit = 128M
dict = keywords
min_infix_len = 1
expand_keywords = 1
path = /var/lib/sphinx/brand
rt_attr_string = name
rt_field = name
rt_field = pinyin
}
#source src1
#{
# type = mysql
#
# sql_host = localhost
# sql_user = test
# sql_pass =
# sql_db = test
# sql_port = 3306 # optional, default is 3306
#
# sql_query = # SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content # FROM documents
#
# sql_attr_uint = group_id
# sql_attr_timestamp = date_added
#}
#
#
#index test1
#{
# source = src1
# path = /var/lib/sphinx/test1
#}
#
#
#index testrt
#{
# type = rt
# rt_mem_limit = 128M
#
# path = /var/lib/sphinx/testrt
#
# rt_field = title
# rt_field = content
# rt_attr_uint = gid
#}
#
#
#indexer
#{
# mem_limit = 128M
#}
searchd
{
#listen = 9312
listen = 9306:mysql41
mysql_version_string = 5.0.0
#mysql_version_string = 5.5.54
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
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /var/lib/sphinx/
}
以上是关于Sphinx的主要内容,如果未能解决你的问题,请参考以下文章