Using ProxySQL to route INSERTs in a distributed RealTime index

In this article we'll discuss a how-to use ProxySQL to route inserts to a distributed RT index while using Sphinx/Manticore Search.

The distributed index in Manticore allow UPDATE over multiple RealTime indexes as the UPDATE is sent to all indexes, but change occurs only on one index (assuming you have unique IDs across the indexes).

For inserts the distributed index doesn't know which index should select, this means we need to send the insert to one of the RealTime subindexes, which must be implemented in the application code. This has the disadvantage that making changes to the distributed index (adding a new RT subindex, for example), requires making changes in the  application code.