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.
shell > tpm connector --samples
Bash mysql -hconnector1 -P3306 -uappuser -ppassword
Perl::dbi
$dbh=DBI->connecti('DBI:mysql:host=connector1;port=3306',
'appuser', 'password')
PHP::mysqli
$dbh = new mysqli('connector1',
'appuser', 'password', 'schema', '3306');
PHP::pdo
$dbh = new
PDO('mysql:host=connector1;port=3306',
'appuser', 'password');
Python::mysql.connector
dbh = mysql.connector.connect(user='appuser',
password='password',
host='connector1', port=3306,
database='schema')
Java::DriverManager
dbh=DriverManager.getConnection("jdbc:mysql://connector1:3306/schema",
"appuser", "password")
After installation the connector will only work with the
--application-user
and
--application-password
options that were
provided during installation. See Section 7.6, “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.