Revision [4156]
Last edited on 2011-09-29 23:26:00 by KenFongAdditions:
Or perhaps
stop slave; set global slave_skip_errors=1062; start slave;
stop slave; set global slave_skip_errors=1062; start slave;
Revision [4155]
Edited on 2011-09-29 23:03:22 by KenFongAdditions:
Do this in a loop:
while [ `mysql -e "show slave status\G" | grep Slave_SQL_Running | awk '{print $2}'` == "No" ]
do
mysql -e "stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave;"
sleep 2
done
while [ `mysql -e "show slave status\G" | grep Slave_SQL_Running | awk '{print $2}'` == "No" ]
do
mysql -e "stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave;"
sleep 2
done
Revision [4107]
Edited on 2011-08-21 23:42:51 by KenFongAdditions:
MYSQL> stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; START SLAVE;
Deletions:
mysql> START SLAVE;
Revision [4103]
Edited on 2011-08-17 01:40:09 by KenFongAdditions:
===Slave status===
Show slave status filtering lines I don't want:
mysql> pager grep Slave
PAGER set to 'grep Slave'
Slave_IO_State: Waiting for master to send event
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
1 row in set (0.00 sec)
Show slave status filtering lines I don't want:
mysql> pager grep Slave
PAGER set to 'grep Slave'
Slave_IO_State: Waiting for master to send event
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
1 row in set (0.00 sec)
Revision [3839]
Edited on 2010-09-15 08:34:05 by KenFongAdditions:
SLAVE_LOG=""
SHARED_PWD="xxxx"
SHARED_PWD="xxxx"
Deletions:
Revision [3838]
Edited on 2010-09-15 08:32:58 by KenFongDeletions:
Revision [3672]
Edited on 2010-03-16 00:55:38 by KenFongAdditions:
===Seeing difference with compression===
tcpdump -i eth0 -s 0 -l -w - dst port 3306
tcpdump -i eth0 -s 0 -l -w - dst port 3306
Revision [3671]
Edited on 2010-03-16 00:53:51 by KenFongAdditions:
slave_compressed_protocol=1
Revision [3659]
Edited on 2010-03-08 21:12:25 by WikiAdminAdditions:
replicate-wild-do-table=database1.%
Deletions:
replicate-do-db=database3
Revision [3445]
Edited on 2009-07-23 22:17:34 by WikiAdminAdditions:
# selectively replicate
# binlog-do-db=db_name
7.Restore snapsnot backup taken in step 1 to slave database. One can also use mysqldump-restore to achieve the same. dump with the --with-master-data option. then the master log position will be recorded in first 30 lines or so in the dump file.
# binlog-do-db=db_name
7.Restore snapsnot backup taken in step 1 to slave database. One can also use mysqldump-restore to achieve the same. dump with the --with-master-data option. then the master log position will be recorded in first 30 lines or so in the dump file.
Deletions:
Revision [2234]
Edited on 2009-02-26 02:15:23 by WikiAdminAdditions:
# rename relay-log.info which contains info about the problematic relay log
Revision [2208]
Edited on 2009-02-16 03:04:23 by WikiAdminAdditions:
===Fix broken relay logs===
You may instruct mysql to purge current relay logs and restart replication at a certain point. See the following example:
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State:
...
Master_Log_File: db01-bin.000009
Read_Master_Log_Pos: 127484667
Relay_Log_File: ws01-relay.000032
Relay_Log_Pos: 115781533
Relay_Master_Log_File: db01-bin.000009 <-- set master_log_file to this
Slave_IO_Running: No
Slave_SQL_Running: No
...
Exec_Master_Log_Pos: 115781384 <-- set master_log_pos to this
...
1 row in set (0.92 sec)
mysql> stop slave
mysql> change master to master_log_file='db01-bin.000009', master_log_pos=115781384;
mysql> start slave
You may instruct mysql to purge current relay logs and restart replication at a certain point. See the following example:
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State:
...
Master_Log_File: db01-bin.000009
Read_Master_Log_Pos: 127484667
Relay_Log_File: ws01-relay.000032
Relay_Log_Pos: 115781533
Relay_Master_Log_File: db01-bin.000009 <-- set master_log_file to this
Slave_IO_Running: No
Slave_SQL_Running: No
...
Exec_Master_Log_Pos: 115781384 <-- set master_log_pos to this
...
1 row in set (0.92 sec)
mysql> stop slave
mysql> change master to master_log_file='db01-bin.000009', master_log_pos=115781384;
mysql> start slave
Revision [2085]
Edited on 2008-11-07 02:28:18 by WikiAdminAdditions:
log-bin=hostname-bin
relay-log=hostname-relay
relay-log=hostname-relay
Deletions:
Revision [2066]
Edited on 2008-11-03 00:13:58 by WikiAdminAdditions:
==Missing relay logs==
What if your relay logs are missing? As long as the binlogs are still here, one can do the followings and mysql will fetch fresh copies of relay logs automatically:
service mysql stop
rm -f $MYSQL_DATADIR/relay-log.info
rm -f $MYSQL_RELAYLOG/hostname-relay-bin.*
service mysql start
What if your relay logs are missing? As long as the binlogs are still here, one can do the followings and mysql will fetch fresh copies of relay logs automatically:
service mysql stop
rm -f $MYSQL_DATADIR/relay-log.info
rm -f $MYSQL_RELAYLOG/hostname-relay-bin.*
service mysql start
Revision [1917]
Edited on 2008-09-01 22:04:44 by WikiAdminAdditions:
log_slave_updates=1
read_only=1
read_only=1
Revision [1781]
Edited on 2008-06-30 08:48:38 by WikiAdminAdditions:
Some poorly designed software do uses custom functions for primary key and they may cause duplicate entry error when that function generates repeated string as the key. The following tells MySQL to ignore duplicate entry error and move on.
%%(text;my.cnf)
slave-skip-errors = 1062
%%(text;my.cnf)
slave-skip-errors = 1062
Revision [1746]
Edited on 2008-06-02 21:34:55 by WikiAdminAdditions:
MYSQL>grant replication [slave] on *.* to repl@'%' identified by 'blah';
Deletions:
Revision [1621]
Edited on 2008-04-08 00:56:02 by WikiAdminAdditions:
==Fix broken replication==
If replication is stalled because of a query does not run on slave and you are sure that query is of no significance, do these:
mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
mysql> START SLAVE;
If replication is stalled because of a query does not run on slave and you are sure that query is of no significance, do these:
mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
mysql> START SLAVE;
Revision [1577]
Edited on 2008-03-31 01:17:58 by WikiAdminAdditions:
Fix broken replication: http://homepage.mac.com/kelleherk/iblog/C711669388/E226281480/index.html
# master logs are applied to slave and can be purged
mysql -p$SHARED_PWD -h$MASTER_HOST -se "purge master logs to '$MASTER_LOG'"
# master logs are applied to slave and can be purged
mysql -p$SHARED_PWD -h$MASTER_HOST -se "purge master logs to '$MASTER_LOG'"
Deletions:
mysql -p$SHARED_PWD -h$MASTER_HOST -se "purge master logs to '$MASTER_LOG'"