List:Replication« Previous MessageNext Message »
From:Miguel Angel Nieto Date:September 22 2009 8:33pm
Subject:Re: borked replication
View as plain text  
Hi,
Try this before:

mysql> stop slave;

Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;

Query OK, 0 rows affected (0.00 sec)

mysql> start slave;


SQL_SLAVE_SKIP_COUNTER is used to skip the last replicated query, the root
of the problem :) Then MySQL will continue with the replication. If you
activate the error log, you could read something like this:

Sep 11 11:13:16 test2 mysqld[6776]: 090911 11:13:16 [ERROR] Slave: Error
‘Table ‘t’ already exists’ on query. Default database:
‘mysql’. Query:
‘CREATE TABLE t (c CHAR(20) CHARACTER SET utf8 COLLATE utf8_bin)’,
Error_code: 1050

Sep 11 11:13:16 test2 mysqld[6776]: 090911 11:13:16 [ERROR] Error running
query, slave SQL thread aborted. Fix the problem, and restart the slave SQL
thread with “SLAVE START”. We stopped at log ‘mysql-bin.000003’
position 421


In this example, "CREATE TABLE t" is the query that I must skip :)

If SLAVE_SKIP don't work, your solution is OK too, but you have to start the
replication with a new MASTER_LOG_POS.

2009/9/22 Andrei F <frunzales@stripped>

> Hello,
>
> I'm trying to fix a MySQL replication issue. Currently here are major
> discrepancies between the master and the slave.
> Replication has been broken for the past couple of weeks. Here's my plan,
> please correct me if I'm wrong:
>
> 1) grab a dump of the master (server) database: mysqldump -u -p dbname >
> dbname.sql
>
> 2) drop the slave/partially replicated database on the slave server: drop
> database <dbname>
>
> 3) import the db dump created at step #1 into the slave server.
>
> 4) start replication.
>
> 5) get rid of old binary log cruft that's no longer needed.
>
> Again, please correct me if I'm wrong.
>
> regards
>



-- 
Lo que haría sería hacerme pasar por sordomudo y así no
tendría que hablar.
Si querían decirme algo, tendrían que escribirlo en un papelito y
enseñármelo. Al final se hartarían y ya no tendría que hablar
el resto de mi
vida.

Thread
borked replicationAndrei F22 Sep
  • Re: borked replicationMiguel Angel Nieto22 Sep
  • Re: borked replicationMarcus Bointon23 Sep
    • Re: borked replicationPankaj Joshi23 Sep
  • Re: borked replicationIan Simpson23 Sep
  • Re: borked replicationAndrej Pintar23 Sep
    • Re: borked replicationAndrei F23 Sep
      • Re: borked replicationapi98424 Sep
      • Re: borked replicationMats Kindahl25 Sep