Reclaim space on full db servers
ArielGlenn (Talk | contribs) (Created page with '== Remove old relay logs == MySQL servers running version 4.* have a bug (here's [http://bugs.mysql.com/bug.php?id=5096 one], maybe there are others) which results in the [http:/...') |
ArielGlenn (Talk | contribs) (→Remove old bin logs) |
||
| (3 intermediate revisions by one user not shown) | |||
| Line 7: | Line 7: | ||
from fenari. This stops the slave, issues a [http://dev.mysql.com/doc/refman/5.0/en/reset-slave.html RESET SLAVE] command (which automatically tosses all old relay logs and opens a fresh one) and restarts the slave. | from fenari. This stops the slave, issues a [http://dev.mysql.com/doc/refman/5.0/en/reset-slave.html RESET SLAVE] command (which automatically tosses all old relay logs and opens a fresh one) and restarts the slave. | ||
| + | |||
| + | == Remove old bin logs == | ||
| + | |||
| + | Old [http://dev.mysql.com/doc/refman/5.0/en/binary-log.html bin logs] also pile up in /a/sqldata. You can check the slave hosts to see which bin log file they are using and toss all the earlier ones. Check the one in use on each slave by looking at db.php for the slaves and giving the command 'SHOW SLAVE STATUS' and looking at the column Master_Log_File. Then you can clear the old logs out with the mysql command | ||
| + | |||
| + | <code> | ||
| + | [http://dev.mysql.com/doc/refman/5.0/en/purge-binary-logs.html PURGE MASTER LOGS] TO 'name-of-bin-log-file-here' | ||
| + | </code> | ||
| + | |||
| + | and this will remove all bin logs older than the specified file. It syncs up the index file for these logs as well. (On mysql 5.x hosts you can issue the command PURGE BINARY LOGS instead.) | ||
| + | |||
| + | [[Category:How-To]] | ||
| + | [[Category:MySQL]] | ||
Latest revision as of 06:34, 9 November 2010
[edit] Remove old relay logs
MySQL servers running version 4.* have a bug (here's one, maybe there are others) which results in the relay logs not being deleted. Space will eventually fill up on /a/sqldata due to this bug. You can clear out the old logs by running the utility
reset-mysql-slave hostname-here
from fenari. This stops the slave, issues a RESET SLAVE command (which automatically tosses all old relay logs and opens a fresh one) and restarts the slave.
[edit] Remove old bin logs
Old bin logs also pile up in /a/sqldata. You can check the slave hosts to see which bin log file they are using and toss all the earlier ones. Check the one in use on each slave by looking at db.php for the slaves and giving the command 'SHOW SLAVE STATUS' and looking at the column Master_Log_File. Then you can clear the old logs out with the mysql command
PURGE MASTER LOGS TO 'name-of-bin-log-file-here'
and this will remove all bin logs older than the specified file. It syncs up the index file for these logs as well. (On mysql 5.x hosts you can issue the command PURGE BINARY LOGS instead.)