Hello friends,
I am exploring using MySQL cluster with MySQL router with Perl 5. I have not been able to find any information on how to modify my database interface in Perl to connect to a cluster. Have any of you done this? My objective is for both fail over and scaling.
Here is my existing code for how I connect to MySQL. Currently, this is just a single instance of MySQL.
use DBI;
use strict;
use warnings;
my $driver= "mysql";
my $dsn = "DBI:$driver:database=$database;host=$host";
my $dbh = DBI->connect($dsn, $user, $pw);
$dbh->do('INSERT INTO test_table (fname, lname, email, comment) VALUES
+ (?, ?, ?, ?)',
undef,
$fname, $lname, $email, $comment);
The above works fine. My hope is that MySQL clustering magically lets me use DBI and everything just like above. However, in the literature it seems that I would point my application to a MySQL router (mysqlrouter) instead of directly to the MySQL database.
If I should be taking an entirely different direction to clustering for fail over and scaling feel free to let me know. The only requirements for the project are that we stick with Perl 5 and MySQL.
Thank you in advance!