0

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?

user984976
  • 1,314
  • 1
  • 12
  • 21
  • Have you tried 'reload' (it might be a command in init script) otherwise, send SIGHUP directly to searchd to cause to reload the config file. – barryhunter Mar 14 '16 at 10:30
  • @baghunter: it seems to me that reload is just an alias for restart. Can you explain what you mean about sending the SIGHIP directly to searchd? – user984976 Mar 15 '16 at 17:58
  • Sending SIGHUP (note the spelling!) to searchd, should tell it to reload the config. https://www.google.com/search?q=SIGHUP+sphinxsearch – barryhunter Mar 15 '16 at 18:03

0 Answers0