-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcsft_mysql_astost.conf
executable file
·122 lines (108 loc) · 5.53 KB
/
csft_mysql_astost.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
source astost
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = 794613
sql_db = astost
sql_port = 3306 # optional, default is 3306
# 定义连接数据库后取数据之前执行的SQL语句
sql_query_pre = SET NAMES utf8
#sql_query_pre = SET SESSION query_cache_type=OFF
# 创建一个sph_counter用于增量索引
sql_query_pre = CREATE TABLE IF NOT EXISTS sph_counter (counter_id integer primary key not null, max_update_time datetime not null)
# 取数据之前将表的最大id记录到sph_counter表中
sql_query_pre = REPLACE INTO sph_counter SELECT 1, MAX(update_time) FROM post
#sql_query_range = select 1,max(update_time) from post
# main document fetch query
# mandatory, integer document ID field MUST be the first selected column
# 定义取数据的SQL,第一列ID列必须为唯一的正整数值
sql_query = \
SELECT tid, fid, user, uid, title, UNIX_TIMESTAMP(post_time) AS post_time, UNIX_TIMESTAMP(alter_time) AS alter_time, UNIX_TIMESTAMP(update_time) AS update_time \
FROM post where update_time <=(select max_update_time from sph_counter where counter_id=1)
#sql_attr_uint = tid
sql_attr_string = fid
sql_attr_string = user
sql_attr_uint = uid
#sql_attr_string = title
sql_attr_timestamp = post_time
sql_attr_timestamp = alter_time
sql_attr_timestamp = update_time
}
# 定义一个增量的源
source delta:astost
{
sql_query_pre = set names utf8
# 增量源只查询上次主索引生成后新增加的数据
# 如果新增加的searchid比主索引建立时的searchid还小那么会漏掉
sql_query = SELECT tid, fid, user, uid, title, UNIX_TIMESTAMP(post_time) AS post_time, UNIX_TIMESTAMP(alter_time) AS alter_time, UNIX_TIMESTAMP(update_time) AS update_time \
FROM post where update_time > (SELECT max_update_time FROM sph_counter WHERE counter_id=1)
sql_query_post_index = replace into sph_counter select 1, max(update_time) from post
}
index astost
{
# 设置索引的源
source = astost
# 设置生成的索引存放路径
path = /root/search/data/astost
# 中文分词配置,详情请查看:http://www.coreseek.cn/products-install/coreseek_mmseg/
#charset_dictpath = /usr/local/mmseg3/etc/ #BSD、Linux环境下设置,/符号结尾
#charset_dictpath = etc/ #Windows环境下设置,/符号结尾,最好给出绝对路径,例如:C:/usr/local/coreseek/etc/...
charset_type = zh_cn.utf-8
#min_prefix_len = 1
ngram_len = 1
ngram_chars = U+3000..U+2FA1F
}
index delta:astost
{
# 设置索引的源
source = delta
# 设置生成的索引存放路径
path = /root/search/data/delta
}
# 全局index
indexer
{
# 定义生成索引过程使用索引的限制
mem_limit = 128M
}
#############################################################################
## searchd settings
#############################################################################
searchd
{
# 定义监听的IP和端口
listen = 0.0.0.0:9312
# 定义log的位置
log = /root/search/log/astost_sphinx_searchd.log
# 定义查询log的位置
query_log = /root/search/log/astost_sphinx_query.log
# 定义网络客户端请求的读超时时间
read_timeout = 5
# 客户端请求时间限制
##client_timeout = 300
# 定义子进程的最大数量
max_children = 30
# 设置searchd进程pid文件名
pid_file = /var/astost_sphinx_searchd.pid
# 定义守护进程在内存中为每个索引所保持并返回给客户端的匹配数目的最大值
#max_matches = 1000
# 启用无缝seamless轮转,防止searchd轮转在需要预取大量数据的索引时停止响应
# 也就是说在任何时刻查询都可用,或者使用旧索引,或者使用新索引
seamless_rotate = 1
# 配置在启动时强制重新打开所有索引文件
preopen_indexes = 0
# 设置索引轮转成功以后删除以.old为扩展名的索引拷贝
unlink_old = 1
# 最大允许的包大小
max_packet_size = 8M
# 最大允许的过滤器数
max_filters = 256
max_filter_values = 4096
max_batch_queries = 32
workers = threads # for RT to work
# SphinxQL compatibility mode (legacy columns and their names)
# optional, default is 0 (SQL compliant syntax and result sets)
#
# compat_sphinxql_magics = 1
}