02-25-05 10:45 PM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Karl wrote:
> Hi - I'm using mysql Cluster, and trying to get connector/J (tried
> v3.1.6 and 3.1.7) to round-robin the database requests. I'm currently
> testing with 2 databases, so I'd like to have request one go to db1, the
> next to db2, back to db1, etc.
>
> I've got failOverReadOnly set to false, autoReconnect true, and
> roundRobinLoadBalance true.
Karl,
The load balancing happens at connection creation..The connection is
'pinned' to the node it connected to unless that node goes offline. JDBC
isn't really setup as an API to handle load balancing each query for a
given connection across a cluster due to it's stateful nature.
> Currently what happens is all request go to the first database node in
> the connection url. If that node is taken offline, the next request
> fails, after which all requests go to the 2nd database node.
>
> If I bring the first database node back online, all requests still go to
> the 2nd node. Which brings me to another question - is there a way to
> configure the driver to periodically check an 'offline' node to see if
> it has come back online?
It should fall back to the first node it was connected to after either
'queriesBeforeRetryMaster' (default 50) or 'secondsBeforeRetryMaster'
(default 30) expires.
However, I'd tell you that if you'd be better off (and future proofing
yourself), to throw dead connections away and reconnect, as we're going
to deprecate autoReconnect in Connector/J 3.2, and it's going away
probably in 3.3...There's really no reliable and fully transparent way
to make it work with a client/server database.
If you leave autoReconnect=true for now to cover the case where the
'next' node in the round-robin is down, so the driver connects to the
next node, and instead of trying to recover the current connection after
a communications exception is thrown (SQLState that start with '08'),
instead close it, you'll be using the 'new' model we'll be promoting
with Connector/J 3.2 and later.
-Mark
- --
Mark Matthews
MySQL AB, Software Development Manager - Connectivity
www.mysql.com
MySQL User Conference (Santa Clara CA, 18-21 April 2005)
Early registration until February 28: http://www.mysqluc.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCH6fntvXNTca6JD8RAkNaAJ0YyvZvolwa
6PozjhWz3ckLLF62uQCguYw0
VBPPSMnoxZv54Y13vKaUwE0=
=tLxo
-----END PGP SIGNATURE-----
--
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe: http://lists.mysql.com/java?unsub=m....
edu.tw
[ Post a follow-up to this message ]
|