==============
<?php
$dbuser = 'root';
$dbpass = 'rahasiaaa';
$dbserver = 'localhost';
mysql_connect($dbserver,$dbuser,$dbpass) or die("Koneksi gagal");
while (true) {
// ambil status slave
$sql = 'show slave status';
$hasil = mysql_query($sql);
$x = mysql_fetch_array($hasil);
//var_dump($x);
// jika ada error 'Duplicate entry', maka skip query tsb
if (($x['Slave_SQL_Running'] == 'No') && (stripos($x['Last_Error'], 'Duplicate entry'))) {
echo "Found problem: ".$x['Last_Error']." — restarting Replication… n";
// skip the problematic query
$sql = 'STOP SLAVE';
$hasil = mysql_query($sql);
$sql = 'SET GLOBAL sql_slave_skip_counter=2';
$hasil = mysql_query($sql);
$sql = 'START SLAVE';
$hasil = mysql_query($sql);
// wait 1 sec before checking again
sleep(1);
};
};
?>
Post imported by Google+Blog for WordPress.
gak ada coment gan, wes joss hehehehehehe
pkok ejos gandos, hahahaha