db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Frampton <keith.framp...@trapezegroup.com>
Subject MySQL read replication load balancing through torque
Date Tue, 27 Oct 2015 12:29:56 GMT
We have software that is using Torque to directly connect to database servers.  We now have
a requirement to use a master / slave MySQL set up and our client are reluctant to put a load
balancer in the way.  I've been trying to establish if it's possible through Torque to use
the MySQL read replication driver.

As Google turned up limited information, I couldn't find anything on the mailing list (searched
via http://httpd.markmail.org) and a list of supported drivers for Torque did not show the
MySQL read replication driver, this email is the last ditch effort to find an answer.

The connection String (torque.dsfactory.[db].datasource.url) I've been setting as  jdbc:mysql:replication://[master]:3306,[slave]:3306/[db].
I've tried setting the driver to com.mysql.jdbc.ReplicationDriver
I've changed the factory from JndiDataSourceFactory to SharedPoolDataSourceFactory.
I believe the adapter was incorrect as it was set to org.gjt.mm.mysql.Driver so I've changed
that to MySQL and also tried changing it to the DBMM class.

Unfortunately it's difficult for me to give code exerts as it's configured through a configuration
module into a bean that assigns the properties from a mix of static Strings and values from
the config module.

The 2 issues I hit for every combination of changes I make are either a null pointer in org.apache.torque.adapter.DBFactory
in the function create(String key, String className) for the adapterClass (this is what lead
me to the conclusion the adapter was incorrect as the original jira suggested it would be
as simple as changing the adapter from org.gjt.mm.mysql.Driver to com.mysql.jdbc.ReplicationDriver.

Or a SQL exception stating that I must specify at least one slave, however, everything I can
see suggests the connection string is correct for a read replication connection.

Any help would be greatly appreciated.

Many thanks for your time,

Keith Frampton
Trapeze Group

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message