{"id":270,"date":"2019-02-19T14:03:56","date_gmt":"2019-02-19T13:03:56","guid":{"rendered":"http:\/\/blog.balazspocze.me\/?p=270"},"modified":"2026-11-10T05:52:00","modified_gmt":"2026-11-10T05:52:00","slug":"dealing-with-mysql-relay-logs-when-disk-space-is-limited-but-the-replica-is-far-behind-the-source","status":"publish","type":"post","link":"https:\/\/banyek.net\/?p=270&lang=en","title":{"rendered":"Dealing with MySQL relay logs when disk space is limited, but the replica is far behind the source"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I just encountered the problem described in the title, on a server I don&#8217;t have enough free space for create a backup as long the replica is catching up, because the relay logs eats all the available free space as the IO thread works faster than the SQL thread in the replication. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What to do? First, we need to get rid of the current relay logs, and then limit the server to not create too much in the future. The relay logs are not meant for manual deletion so we stop the replica, purge the relay logs, set back the replica to the previous position and then restart the mysqld with the relay_log_space_limit variable set up.<\/p>\n\n\n\n<p>\n<pre>\nmysql> STOP SLAVE;\nmysql> PAGER egrep \"Relay_Master_Log_File|Exec_Master_Log_Pos\"\nmysql> SHOW SLAVE STATUS\\G\nmysql> RESET SLAVE ALL;\nmysql> CHANGE MASTER TO ...\nmysql> START SLAVE;\nmysql> ^d\nbash> echo \"relay-log-space-limit = 10737418240\" >>\/etc\/mysql\/my.cnf #10G\nbash> systemctl mysql restart \n<\/pre>\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>As<\/em><a href=\"http:\/\/www.linkedin.com\/in\/jfg956\/\"><em> Jean-Fran\u00e7ois Gagn\u00e9 <\/em><\/a><em>pointed out (right) this is only applies on a really simple case when there is no GTID configured, no parallel replication exists, the slave is not delayed, no SSL, etc.etc.<\/em> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just encountered the problem described in the title, on a server I don&#8217;t have enough free space for create a backup as long the replica is catching up, because the relay logs eats all the available free space as the IO thread works faster than the SQL thread in the replication. What to do? [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[134],"tags":[144,126],"class_list":["post-270","post","type-post","status-publish","format-standard","hentry","category-tech-en","tag-mysql-en","tag-oldblog-en"],"_links":{"self":[{"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts\/270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=270"}],"version-history":[{"count":1,"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts\/270\/revisions"}],"predecessor-version":[{"id":406,"href":"https:\/\/banyek.net\/index.php?rest_route=\/wp\/v2\/posts\/270\/revisions\/406"}],"wp:attachment":[{"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/banyek.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}