perl - MariaDB replication some times does not working -


i have problem have never seen before mysql replication (master/slave): works excellent when execute on php scripts, on mysql console queries "insert into". replicated on mysql slave machine. but: not if same operations on perl script, using perl dbi. stored on mysql master server. in mysql.log file on slave server, nothing arrives. have problem since migrated on 2 servers mysql mariadb. there perl dbi client should absolutely replicating work?

i'm using simple code insert data:

#!/usr/bin/perl use dbi; $dsn = 'dbi:mysql:database=mysql;host=myhostname'; $dbh = dbi->connect($dsn, 'mouser', 'password',             { raiseerror => 1, autocommit => 0 }) || exit(1); ... $sth = $dbh->prepare("insert mydatabase.mytable (user, domain) values('$account_name', '$domain')"); $sth->execute(); $dbh->commit(); 

is possible not replicate because dbi should use mariadb driver? $dsn = 'dbi:mariadb:database=mysql;host=myhostname'; if exists?

to clear: data inserted php script still being replicated after switching mariadb, data inserted perl script isn't.

i found reason why replication failed simple perl script: there written:

$dsn = 'dbi:mysql:database=mysql;host=myhostname'; ... $sth = $dbh->prepare("insert mydatabase.mytable (user, domain) values('$account_name', '$domain')"); 

this not working, because dbi connects database "mysql" , not "mydatabase" (see "database=mysql"). if insert inserts row directly in database "mydatabase", mariadb master server ignores replication. strange worked mysql , not mariadb (version 5.5.46). maybe bug in mariadb, don't know.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -