Clients and Deployment
In order to get the benefits of Tungsten Cluster your application must use the Tungsten Connector. The connector is compatible with MySQL
drivers and applications. Use the tpm connector --samples command to see examples of how you can invoke a connection on your own.
You may need to adapt these examples to your application and configuration method but the connection details should be the same.
Passwords are obfuscated in the output and will need replacing with the correct password that you configured.
shell > tpm connector --samples
Bash -
mysql -hdb1 -P3306 -uapp_user -p'PASSWORD_OBFUSCATED'
Perl::dbi -
$dbh = DBI->connecti('DBI:mysql:host=db1;port=3306', 'app_user', 'PASSWORD_OBFUSCATED')
PHP::mysqli -
$dbh = new mysqli('db1', 'app_user', 'PASSWORD_OBFUSCATED', 'schema', '3306');
PHP::pdo - $
dbh = new PDO('mysql:host=db1;port=3306', 'app_user', 'PASSWORD_OBFUSCATED');
Python::mysql.connector -
dbh = mysql.connector.connect(user='app_user', password='PASSWORD_OBFUSCATED', host='db1', port=3306, database='schema')
Java::DriverManager -
dbh=DriverManager.getConnection("jdbc:mysql://db1:3306/schema", "app_user", 'PASSWORD_OBFUSCATED')
If the default Bridge Mode was disabled in favour of Proxy mode, then after installation the connector will only work with the application-user and
application-password options that were provided during installation. See "User Authentication" if you need more information on adding users to
user.map.
By default the connection will always be sent to the current Primary. This behavior can be modified by implementing one of the "Routing Methods" to send some traffic to Replica datasources.
Connection Pools
Tungsten Connector can work behind a connection pool without any issue.
Upon switch or failover, all connections in the pool will be broken but not closed. The very next time one of these pooled connections is used, it
will be transparently reconnected unless autoReconnect has been disabled by the tpm installation flag
connector-autoreconnect=false
When using a connection pool mechanism in applications, the dynamic connection setting maxAppliedLatency should not be used. This setting is only
meaningful at connection time; since connection pools open a set of connections, the applied latency will most probably be outdated when the application will
actually use the pooled connection