Sphinx-如何动态添加实时索引?

Sphinx-如何动态添加实时索引?,sphinx,sphinxql,Sphinx,Sphinxql,我们目前正在生产服务器上运行带有实时索引的Sphinx。我们的多租户体系结构意味着我们为每个租户维护一个单独的索引(我们将租户分离到单独的数据库中,并选择在Sphinx中维护这种隔离) 然而,我们遇到的问题是,当我们创建一个新的租户时,我们很难让Sphinx“热交换”要添加到新添加的索引中的.conf 示例sphinx.conf index gs_index_cartoncloud_tenant_1 { type = rt dict

我们目前正在生产服务器上运行带有实时索引的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
{
    ....
}

....
尽管我们能够重建配置,但Sphinx在重新启动searchd服务之前不会使用它。要求sphinx重新启动将导致锁定的binlog文件出现问题-这也会导致服务在短时间内退出,这意味着某些文件没有索引-这并不理想


我们正在寻找一种方法,可以“动态”添加一个新的rt索引-这可能吗?

您是否尝试过“重新加载”(可能是init脚本中的一个命令),否则,直接将SIGHUP发送给searchd以使其重新加载配置文件。@baghunter:在我看来,重新加载只是重新启动的别名。你能解释一下把SIGHIP直接发送给searchd是什么意思吗?把SIGHUP(注意拼写!)发送给searchd,应该告诉它重新加载配置。