We're currently running Sphinx with Real-Time Index on a production server. Our multi-tenant architecture means we maintain an individual index for each tenant (we separate our tenants into individual databases, and opted to maintain this isolation within Sphinx).
The issue we have however, is that when we create a new tenant we're having trouble getting Sphinx to 'hot-swap' the .conf to add-in the newly added index.
Example 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
{
....
}
....
Although we're able to rebuild the config it isn't used by Sphinx until the searchd service is restarted. Asking sphinx to restart will result in issues with locked binlog files - this also causes the service to drop-out for a short period of time meaning some files are not indexed - which isn't ideal.
We're looking for a way that we can add a new rt index 'on-the-fly' - is this possible?