Feb 15

So you woke up, because your mysql replication failed suddenly with an error like:

Feb 15 07:41:06 rdb-sl mysqld[18223]: 080215 7:41:06 [ERROR] Failed to open log (file './db-sl-relay-bin.000030', errno 2)
Feb 15 07:41:06 db-sl mysqld[18223]: 080215 7:41:06 [ERROR] Failed to open the relay log './db-sl-relay-bin.000030' (relay_log_pos 75527094)
Feb 15 07:41:06 db-sl mysqld[18223]: 080215 7:41:06 [ERROR] Could not open log file

before you consider making a mysqldump –masterdata on the master database and reimport the entire dump.. try this:

-> stop mysql on the slave server
-> find the directory that contains the relay logs (usually /var/lib/mysql)
-> delete all relay logs called hostname-relay-bin.XXX, hostname-relay-bin.index and relay-log.info
-> restart mysql

Your mysql will start with fresh relay logs and is getting the missing data directly from the master server, as there will be probably still bin logs!

Note: This is a kind of last resort action, no guarantees here 🙂

Tagged with:
preload preload preload