Mac

November 10, 2006

Fixing a broken replication in MySQL

Filed under: Database — mac @ 6:58 pm

The easy way…

Log on to the slave and do a “load data from master” :

host:/home/mac# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 131 to server version: 4.0.24_Debian-10sarge2-log
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql> load data from master;
ERROR 1189: Net error reading from master

This means that there is most likely a corruption in your logfiles…

What to do ?

* On the direct parent :

mysqldump -a --add-drop-table -e -x -p --master-data
-u root -p -B DB_to_Replicate > /tmp/master.sql

* Copy the file to the slave
* On the slave :

mysql> stop slave;
mysql> . /tmp/master.sql
mysql> start slave;
mysql> show slave status;

Wait a bit and check that the replication catches on…

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

2 Comments »

  1. Bookmarks…

    I can’t add your post to Digg. How I do this?…

    Trackback by MOBY — August 10, 2007 @ 9:58 am

  2. Hi Moby,

    I just installed an plugin for you to do so. Please let me know if it works.

    Mac

    Comment by mac — August 21, 2007 @ 5:14 pm

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.

Powered by WordPress