Web lists-archives.com

Re: slave to master




I quote this from the page[1]:
Load balancing implementation Random picking

When initializing a connection or after a failed connection, the connector
will attempt to connect to a host with a certain role (slave/master). The
connection is selected randomly among the valid hosts. Thereafter, all
statements will run on that database server until the connection will be
closed (or fails).

The load-balancing will includes a pooling mechanism. Example: when
creating a pool of 60 connections, each one will use a random host. With 3
master hosts, the pool will have about 20 connections to each host.
Master/slave distributed load

For a cluster composed of masters and slaves on connection initialization,
there will be 2 underlying connections: one with a master host, another
with a slave host. Only one connection is used at a time.
For a cluster composed of master hosts only, each connection has only one
underlying connection.
The load will be distributed due to the random distribution of connections..
Master/slave connection selection It’s the application that has to decide
to use master or slave connection (the master connection is set by default).
Switching the type of connection is done by using JDBC
connection.setReadOnly(boolean
readOnly)
<http://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#setReadOnly%28boolean%29>
method. Setting read-only to true will use the slave connection, false, the
master connection.

[1]
https://mariadb.com/kb/en/mariadb/failover-and-high-availability-with-mariadb-connector-j/

So I think it is not implemented yet. as "the application has to decide to
use master or slave connection (the master connection is set by default)."

--
Eng. Mahmoud Alshinhab
AWS Cloud Support Engineer
Fedora Ambassador
Wiki : https://fedoraproject.org/wiki/User:Tuxawy
mahmoud.alshinhab@xxxxxxxxx
tuxawy@xxxxxxxxxxxxxxxxx

On Fri, Apr 29, 2016 at 5:14 PM, Mahmoud Alshinhab <
mahmoud.alshinhab@xxxxxxxxx> wrote:

> It was actually built for Amazon's Aurora, but it should work with any
> mysql-compatible protoco.
>
> --
> Eng. Mahmoud Alshinhab
> AWS Cloud Support Engineer
> Fedora Ambassador
> Wiki : https://fedoraproject.org/wiki/User:Tuxawy
> mahmoud.alshinhab@xxxxxxxxx
> tuxawy@xxxxxxxxxxxxxxxxx
>
> On Fri, Apr 29, 2016 at 3:13 PM, Reindl Harald <h.reindl@xxxxxxxxxxxxx>
> wrote:
>
>>
>> Am 29.04.2016 um 15:07 schrieb Johan De Meersman:
>>
>>> From: "Mahmoud Alshinhab" <mahmoud.alshinhab@xxxxxxxxx>
>>>> Subject: Re: slave to master
>>>>
>>>
>>> I think you should have a look at MariaDB Connector[1].
>>>>
>>>
>>> It provides Load balancing and failover as Failover occurs when a
>>>> connection to
>>>> a primary database server fails and the connector will open up a
>>>> connection to
>>>> another database server.
>>>>
>>>
>>> Hmm, I didn't know that they built that into it, interesting. Does it
>>> require server features, or would it work with any mysql-compatible
>>> protocol ?
>>>
>>> Load balancing allows load (read and write) to be distributed over
>>>> multiple
>>>> servers.
>>>>
>>>
>>> Is read-write splitting also built-in, then?
>>>
>>
>> here you go: https://mariadb.com/de/products/mariadb-maxscale and forget
>> about "MariaDB Connector" whatever that is
>>
>>
>