我们目前正在生产服务器上运行带有实时索引的Sphinx。我们的多租户架构意味着我们为每个租户维护一个单独的索引(我们将租户分成单独的数据库,并选择在Sphinx中保持这种隔离)。
然而,我们遇到的问题是,当我们创建一个新租户时,我们无法让Sphinx“热插拔”.conf来添加新添加的索引。
示例sphinx.conf
index gs_index_cartoncloud_tenant_1
{
type = rt
dict = keywords
min_prefix_len = 3
expand_keywords = 1
rt_mem_limit = 32M
path = /var/lib/sphinx/gs_index_tenant_1
rt_field = title
rt_attr_string = title
rt_field = heading
rt_attr_string = heading
rt_field = body
rt_attr_string = body
rt_field = model_name
rt_attr_string = model_name
rt_attr_uint = weight
rt_attr_uint = customer_id
rt_attr_timestamp = created
}
index gs_index_cartoncloud_tenant_2
{
type = rt
dict = keywords
min_prefix_len = 3
expand_keywords = 1
rt_mem_limit = 32M
path = /var/lib/sphinx/gs_index_tenant_2
rt_field = title
rt_attr_string = title
rt_field = heading
rt_attr_string = heading
rt_field = body
rt_attr_string = body
rt_field = model_name
rt_attr_string = model_name
rt_attr_uint = weight
rt_attr_uint = customer_id
rt_attr_timestamp = created
}
index gs_index_cartoncloud_tenant_3
{
....
}
....
虽然我们能够重建配置,但在重新启动searchd服务之前,Sphinx不会使用它。要求sphinx重启会导致锁定的binlog文件出现问题 - 这也会导致服务在短时间内退出,这意味着某些文件没有编入索引 - 这是不理想的。
我们正在寻找一种方法,我们可以“即时”添加新的rt指数 - 这可能吗?