sphinx - SphinxSearch - 索引器配置选项问题
问题描述
我使用 sphinx search 在我的 PostgreSQL 数据库中创建索引和搜索数据。
我有两个问题。
如果我运行命令
/usr/bin/indexer --config /etc/sphinxsearch/sphinx.conf --rotate --all
我从“显示表格”中得到输出;
指数 | 类型 |
---|---|
dist_title_de | 分散式 |
word_title_de | 当地的 |
word_titlestemmed_de | 当地的 |
rt_title_de | rt |
但是如果我运行命令
/usr/bin/indexer --config /etc/sphinxsearch/sphinx_another_conf_file.conf --rotate --all
然后我在终端上得到相同的输出,但我没有在“显示表”上看到新的索引;似乎索引器中的“--config”选项不起作用,只有正确的名称是 sphinx.conf。这是有问题的,因为如果我想重新索引 sphinxsearch,我必须更改文件 sphinx.conf。
- 第二个问题是否可以在不删除旧索引的情况下“添加”新索引?目前我使用狮身人面像(每天):
- 获取新数据(datasource1、datasource2、...、datasource8)
- 索引 --rotate --all (索引来自 8 个数据源的数据)
- 搜索一些关于索引的信息
- 将其写入数据库
但是现在,我想要这样的东西:
- 从 datasource1 获取新数据
- 索引数据源1
- 从datasource2获取新数据
- 索引datasource2(不删除索引datasource1)
- 在索引 datasource1 中搜索某些内容
- ……
- 获取新数据表单datasource8(不删除索引)
- 索引数据源8等
关于“不删除索引”,我的意思是,现在如果我使用主题顶部的命令,我会“丢失”我的索引并只获得新的索引(来自 sphinx.conf)。
我的 sphinx.conf(只有 1 个数据源):
source src_title_de
{
type = pgsql
sql_host = #######
sql_user = #######
sql_pass = #######
sql_db = #######
sql_port = 3306 # optional, default is 3306
sql_query = \
SELECT id, group_id, (date_extraction::TIMESTAMP) AS date_extraction, title \
FROM sphinx_test
sql_ranged_throttle = 0
}
index word_title_de
{
source = src_title_de
path = /var/lib/sphinxsearch/data/word_title_de
docinfo = extern
dict = keywords
mlock = 0
morphology = none
stopwords = /var/lib/sphinxsearch/data/stopwords.txt
wordforms = /var/lib/sphinxsearch/data/wordforms_de.txt
min_word_len = 1
}
index word_titlestemmed_de : word_title_de
{
path = /var/lib/sphinxsearch/data/word_titlestemmed_de
morphology = stem_en
}
index dist_title_de
{
type = distributed
local = word_title_de
local = word_titlestemmed_de
agent = localhost:9313:remote1
agent = localhost:9314:remote2,remote3
agent_connect_timeout = 1000
agent_query_timeout = 3000
}
index rt_title_de
{
type = rt
path = /var/lib/sphinxsearch/data/rt_title_de
rt_field = title
rt_field = content
rt_attr_uint = gid
}
indexer
{
mem_limit = 128M
}
searchd
{
listen = 9312:sphinx
listen = 9306:mysql41
log = /var/log/sphinxsearch/searchd.log
query_log = /var/log/sphinxsearch/query.log
read_timeout = 5
client_timeout = 300
max_children = 30
persistent_connections_limit = 30
pid_file = /var/run/sphinxsearch/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
mva_updates_pool = 1M
max_packet_size = 8M
max_filters = 256
max_filter_values = 4096
max_batch_queries = 32
workers = threads # for RT to work
}
我的 8 个数据源的第二个文件与上面相同,在 'source src_title_de'、'index word_title_de'、'index word_titlestemmed_de'、'index rt_title_de' 上使用 CTRL+C CTRL+V 与另一个国家/地区并使用 'sql_query' 中的数据更改表.
解决方案
在您的第一个问题上,该--config
选项仅适用于该indexer
运行。即 --all 应该导致它索引(或尝试)索引该文件中提到的所有普通索引。
...但是当它发送信号以重新加载(--rotate
)的作用时,searchd
只是重新加载其当前配置文件,而不是您告诉的那个indexer
。
要serachd
使用新的配置文件,必须停止searchd
,然后使用新的配置文件重新启动。
所以直接更改 sphinx.conf,而不是“第二个”文件。
Acully第二个问题是相同的答案......
所以
sphinx.conf
直接改变,而不是“第二个”文件。
即将您的新索引添加到sphinx.conf
,用于indexer
“构建”它。完成indexer
后,它将告诉“重新加载”,这将导致searchd
加载新的配置文件和刚刚构建的新索引。
推荐阅读
- arrays - 如何在矩阵乘法中需要乘以一组元素而不是一个元素
- javascript - Javascript画布路径未呈现
- android - AnimationListener 方法 onAnimationRepeat 未调用
- python - Python:如何列出每个 IBM COS 存储桶的存储桶位置?
- python-3.x - 如何在 Python 3 中清除屏幕?
- node.js - 使用 babel-preset-env 进行转译,而不从 create-react-app 中弹出
- android - MyFragmentPagerAdapter 以“奇怪”的方式显示错误的数据,从位置 0 的位置 1 的数据开始,然后仅在位置 1 其余的
- docker - 使用 cgroups 限制每个 docker 容器的默认 CPU 数量
- css - Chrome 中的 CSS 渐变模糊
- python - 我应该将参数作为继承对象吗?