Load balancing algorithm

Andrew Hutchings ahutchings at nginx.com
Mon Aug 1 11:41:40 UTC 2016

Hi Dewangga,

On 01/08/16 10:36, Dewangga Bachrul Alam wrote:
> Hello!
> On 08/01/2016 04:19 PM, Andrew Hutchings wrote:
>> Hi Dewangga,
>> I'm not quite sure what your desired outcome would be by connecting to
>> two servers at the same time for a single client but it won't work the
>> way you might think it will.
> My main goal is, want to build real-time backup mysql server, so the
> client will be sql insert to different machine at the same time. Got it?
> So the scenario will be like this, if anything goes wrong at the
> cluster, I can check it in cluster4-node1 and pull the data then restore
> to the cluster.

For this to happen NGINX would need to be able to understand MySQL's 
binary protocol rather than relaying packets and there are several 
conditions that would make this very complex (such as an insert 
succeeding on one server and failing on another).

It would be much better to have this logic in your application layer or 
in the database class your application layer uses. Alternatively 
active-passive clustering with async or semi-sync replication and 
keepalived may fit your use case. Or you could use Galera for this 
cluster too.

Kind Regards
Andrew Hutchings (LinuxJedi)
Technical Product Manager, NGINX Inc.

More information about the nginx mailing list